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
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; n<sizeof b64 && b64[n] != un[0]; n++);
for (i=0; i<sizeof b64 && b64[i] != un[1]; i++);
n += i<<6;
+ free(un);
+ return(n);
+}
+
+int edg_wll_LockUnlockJob(const edg_wll_Context ctx,const edg_wlc_JobId job,int lock)
+{
+ struct sembuf s;
+ int n;
+
+
+ if ((n=edg_wll_GetSemID(ctx, job)) == -1) return edg_wll_Error(ctx,NULL,NULL);
+
if (debug) fprintf(stderr,"[%d] semop(%d,%d) \n",getpid(),n % ctx->semaphores,lock);
s.sem_num = n % ctx->semaphores;
#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);