bkserverd.o il_lbproxy.o get_events.o index.o jobstat.o jobstat_supp.o \
seqcode.o write2rgma.o lb_html.o lb_http.o lb_proto.o lb_xml_parse.o \
lb_xml_parse_V21.o lb_text.o \
- lock.o openserver.o query.o userjobs.o db_store.o request.o store.o \
+ openserver.o query.o userjobs.o db_store.o request.o store.o \
stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \
notification.o il_notification.o notif_match.o stats.o db_calls.o db_supp.o
endif
INDEX_OBJS:= index.o index_parse.o jobstat_supp.o openserver.o \
- jobstat.o query.o lock.o get_events.o write2rgma.o index_lex.o \
+ jobstat.o query.o get_events.o write2rgma.o index_lex.o \
lb_authz.o store.o bkindex.o stats.o\
request.o db_store.o srv_purge.o notif_match.o il_lbproxy.o dump.o lb_xml_parse.o il_notification.o lb_proto.o lb_text.o server_state.o lb_xml_parse_V21.o lb_html.o notification.o seqcode.o userjobs.o load.o db_calls.o db_supp.lo
il_lbproxy.o get_events.o index.o jobstat.o jobstat_supp.o \
seqcode.o lb_html.o lb_http.o lb_proto.o lb_xml_parse.o \
lb_xml_parse_V21.o lb_text.o \
- lock.o openserver.o query.o userjobs.o db_store.o request.o store.o \
+ openserver.o query.o userjobs.o db_store.o request.o store.o \
stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \
notification.o il_notification.o notif_match.o stats.o write2rgma.o \
db_calls.o db_supp.o
#include <arpa/nameser.h>
#include <resolv.h>
#include <ares.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
#include <errno.h>
#ifdef GLITE_LB_SERVER_WITH_WS
int use_dbcaps = 0;
static int fake_port = 0;
static char **super_users = NULL;
-static int slaves = 10,
- semaphores = -1,
- semset;
+static int slaves = 10;
static char *purgeStorage = EDG_PURGE_STORAGE;
static char *dumpStorage = EDG_DUMP_STORAGE;
static char *jpregDir = JPREG_DEF_DIR;
{"mysql", 1, NULL, 'm'},
{"noauth", 0, NULL, 'n'},
{"slaves", 1, NULL, 's'},
- {"semaphores", 1, NULL, 'l'},
{"pidfile", 1, NULL, 'i'},
{"purge-prefix", 1, NULL, 'S'},
{"dump-prefix", 1, NULL, 'D'},
{NULL,0,NULL,0}
};
-static const char *get_opt_string = "Ac:k:C:V:p:a:drm:ns:l:i:S:D:J:jR:F:xOL:N:X:Y:T:t:zb:gPBo:q:W:Z:"
+static const char *get_opt_string = "Ac:k:C:V:p:a:drm:ns:i:S:D:J:jR:F:xOL:N:X:Y:T:t:zb:gPBo:q:W:Z:"
#ifdef GLITE_LB_SERVER_WITH_WS
"w:"
#endif
"\t-r, --rgmaexport write state info to RGMA interface\n"
"\t-n, --noauth\t don't check user identity with result owner\n"
"\t-s, --slaves\t number of slave servers to fork\n"
- "\t-l, --semaphores number of semaphores (job locks) to use\n"
"\t-i, --pidfile\t file to store master pid\n"
"\t-L, --limits\t query limits numbers in format \"events_limit:jobs_limit:size_limit\"\n"
"\t-N, --notif-dur default[:max]\t Duration of notification registrations in seconds (default and maximal)\n"
char *ws_port;
#endif /* GLITE_LB_SERVER_WITH_WS */
FILE *fpid;
- key_t semkey;
edg_wll_Context ctx;
edg_wll_GssStatus gss_code;
struct timeval to;
case 'm': dbstring = optarg; break;
case 'n': noAuth = 1; break;
case 's': slaves = atoi(optarg); break;
- case 'l': semaphores = atoi(optarg); break;
case 'S': purgeStorage = optarg; break;
case 'D': dumpStorage = optarg; break;
case 'J': jpregDir = optarg; jpreg = 1; break;
if (fprintf(fpid, "%d", getpid()) <= 0) { perror(pidfile); return 1; }
if (fclose(fpid) != 0) { perror(pidfile); return 1; }
- semkey = ftok(pidfile,0);
-
if (mode & SERVICE_SERVER) {
if (check_mkdir(dumpStorage)) exit(1);
if (check_mkdir(purgeStorage)) exit(1);
}
}
- if (semaphores == -1) semaphores = slaves;
- semset = semget(semkey, 0, 0);
- if (semset >= 0) semctl(semset, 0, IPC_RMID);
- semset = semget(semkey, semaphores, IPC_CREAT | 0600);
- if (semset < 0) { perror("semget()"); return 1; }
- dprintf(("Using %d semaphores, set id %d\n",semaphores,semset));
- for (i=0; i<semaphores; i++)
- {
- struct sembuf s;
-
- s.sem_num = i; s.sem_op = 1; s.sem_flg = 0;
- if (semop(semset,&s,1) == -1) { perror("semop()"); return 1; }
- }
-
if (mode & SERVICE_SERVER) {
if ( fake_host )
{
}
- semctl(semset, 0, IPC_RMID, 0);
unlink(pidfile);
for ( i = 0; i < sizofa(service_table); i++ )
if ( jpreg ) ctx->jpreg_dir = strdup(jpregDir); else ctx->jpreg_dir = NULL;
ctx->hardJobsLimit = hardJobsLimit;
ctx->hardEventsLimit = hardEventsLimit;
- ctx->semset = semset;
- ctx->semaphores = semaphores;
if ( noAuth ) ctx->noAuth = 1;
ctx->rgma_export = rgma_export;
memcpy(ctx->purge_timeout, purge_timeout, sizeof(ctx->purge_timeout));
ctx->isProxy = 1;
ctx->noAuth = 1;
ctx->noIndex = 1;
- ctx->semset = semset;
- ctx->semaphores = semaphores;
if (fake_host)
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <errno.h>
-
-#include "glite/jobid/cjobid.h"
-#include "glite/lb/context-int.h"
-#include "lock.h"
-
-extern int debug;
-
-int edg_wll_JobSemaphore(const edg_wll_Context ctx, glite_jobid_const_t job)
-{
- char *un = edg_wlc_JobIdGetUnique(job);
- int n,i;
- static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
-
-
- 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 % ctx->semaphores);
-}
-
-int edg_wll_LockUnlockJob(const edg_wll_Context ctx,glite_jobid_const_t job,int lock)
-{
- struct sembuf s;
- int n;
-
-
- if ((n=edg_wll_JobSemaphore(ctx, job)) == -1) return edg_wll_Error(ctx,NULL,NULL);
-
- if (debug) fprintf(stderr,"[%d] try semop(%d,%d) \n",getpid(),n,lock);
-
- s.sem_num = n;
- s.sem_op = lock;
- s.sem_flg = SEM_UNDO;
-
- if (semop(ctx->semset,&s,1)) {
- if (debug) fprintf(stderr,"[%d] failed semop(%d,%d) \n",getpid(),n,lock);
- return edg_wll_SetError(ctx,errno,"edg_wll_LockUnlockJob()");
- }
-
- if (debug) fprintf(stderr,"[%d] got semop(%d,%d) \n",getpid(),n,lock);
- return edg_wll_ResetError(ctx);
-}