From 5bd6545fdc1f4d067bbd20a55c91c8ecf7a1f869 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Mula=C4=8D?= Date: Tue, 17 Oct 2006 07:55:17 +0000 Subject: [PATCH] GetSemID added - needs audit! --- org.glite.lb.server/Makefile | 2 +- org.glite.lb.server/src/lock.c | 23 +++++++++++++++++++---- org.glite.lb.server/src/lock.h | 1 + 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/org.glite.lb.server/Makefile b/org.glite.lb.server/Makefile index 6037ecb..46a6b02 100644 --- a/org.glite.lb.server/Makefile +++ b/org.glite.lb.server/Makefile @@ -250,7 +250,7 @@ else PLUGIN_LIB=glite_lb_plugin.la endif -compile: glite_lb_bkserverd glite_lb_bkindex ${STATIC_LIB_BK} ${PLUGIN_LIB} store.c +compile: glite_lb_bkserverd glite_lb_bkindex ${STATIC_LIB_BK} ${PLUGIN_LIB} store.c index.c check: compile test.xml test.query diff --git a/org.glite.lb.server/src/lock.c b/org.glite.lb.server/src/lock.c index 6351846..b4cd987 100644 --- a/org.glite.lb.server/src/lock.c +++ b/org.glite.lb.server/src/lock.c @@ -11,19 +11,34 @@ extern int debug; -int edg_wll_LockUnlockJob(const edg_wll_Context ctx,const edg_wlc_JobId job,int lock) +int edg_wll_GetSemID(const edg_wll_Context ctx, const edg_wlc_JobId job) { - struct sembuf s; char *un = edg_wlc_JobIdGetUnique(job); int n,i; static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; - - if (!un) return edg_wll_SetError(ctx,EINVAL,"jobid"); + + + if (!un) { + edg_wll_SetError(ctx,EINVAL,"jobid"); + return -1; + } for (n=0; nsemaphores,lock); s.sem_num = n % ctx->semaphores; diff --git a/org.glite.lb.server/src/lock.h b/org.glite.lb.server/src/lock.h index c67ec6d..85bb875 100644 --- a/org.glite.lb.server/src/lock.h +++ b/org.glite.lb.server/src/lock.h @@ -2,3 +2,4 @@ #define edg_wll_UnlockJob(ctx,job) edg_wll_LockUnlockJob((ctx),(job),1) int edg_wll_LockUnlockJob(const edg_wll_Context,const edg_wlc_JobId,int); +int edg_wll_GetSemID(const edg_wll_Context ctx, const edg_wlc_JobId job); -- 1.8.2.3