This commit was manufactured by cvs2svn to create branch 'glite-lb- glite-lb-common_R_2_0_0
authorcvs2svn <admin@example.com>
Fri, 5 Aug 2005 14:35:29 +0000 (14:35 +0000)
committercvs2svn <admin@example.com>
Fri, 5 Aug 2005 14:35:29 +0000 (14:35 +0000)
common_branch_2_0_0'.

Sprout from glite-lb-common_branch_1_4_0_2 2005-05-19 11:16:54 UTC cvs2svn <admin@example.com> 'This commit was manufactured by cvs2svn to create branch 'glite-lb-'
Cherrypick from master 2005-08-05 14:35:28 UTC Jiří Škrábal <nykolas@ics.muni.cz> '- return more verbose error message':
    org.glite.lb.common/Makefile
    org.glite.lb.common/build.xml
    org.glite.lb.common/interface/context-int.h
    org.glite.lb.common/interface/lb_maildir.h
    org.glite.lb.common/interface/log_proto.h
    org.glite.lb.common/project/version.properties
    org.glite.lb.common/src/context.c
    org.glite.lb.common/src/events.c.T
    org.glite.lb.common/src/lb_maildir.c
    org.glite.lb.common/src/log_msg.c
    org.glite.lb.common/src/param.c
    org.glite.lb.common/src/xml_parse.c.T

12 files changed:
org.glite.lb.common/Makefile
org.glite.lb.common/build.xml
org.glite.lb.common/interface/context-int.h
org.glite.lb.common/interface/lb_maildir.h [new file with mode: 0644]
org.glite.lb.common/interface/log_proto.h
org.glite.lb.common/project/version.properties
org.glite.lb.common/src/context.c
org.glite.lb.common/src/events.c.T
org.glite.lb.common/src/lb_maildir.c [new file with mode: 0644]
org.glite.lb.common/src/log_msg.c
org.glite.lb.common/src/param.c
org.glite.lb.common/src/xml_parse.c.T

index b77ddcd..8d7c5e9 100644 (file)
@@ -83,15 +83,21 @@ INSTALL:=libtool --mode=install install
 OBJS:=lb_plain_io.o escape.o events.o mini_http.o query_rec.o \
        status.o xml_conversions.o xml_parse.o ulm_parse.o param.o \
        events_parse.o il_string.o il_int.o notifid.o \
-       il_log.o il_msg.o log_msg.o context.o trio.o strio.o
+       il_log.o il_msg.o log_msg.o context.o trio.o strio.o lb_maildir.o
 LOBJS:=${OBJS:.o=.lo}
 
+TRIO_OBJS:=escape.o trio.o strio.o
+TRIO_LIB:=libglite_lb_trio.a
+
+MAILDIR_OBJS:=lb_maildir.o
+MAILDIR_LIB:=libglite_lb_maildir.a
+
 THROBJS:=${OBJS:.o=.thr.o}
 THRLOBJS:=${OBJS:.o=.thr.lo}
 
 HDRS:=context-int.h lb_plain_io.h mini_http.h authz.h xml_parse.h \
        xml_conversions.h log_proto.h events_parse.h il_string.h il_msg.h \
-       escape.h ulm_parse.h trio.h
+       escape.h ulm_parse.h trio.h lb_maildir.h
 
 STATICLIB:=libglite_lb_common_${nothrflavour}.a
 THRSTATICLIB:=libglite_lb_common_${thrflavour}.a
@@ -102,7 +108,7 @@ REPORTS:=${top_srcdir}/reports
 
 default: all
 
-all compile: check_version ${STATICLIB} ${LTLIB} ${THRSTATICLIB} ${THRLTLIB}
+all compile: check_version ${STATICLIB} ${LTLIB} ${THRSTATICLIB} ${THRLTLIB} ${TRIO_LIB} ${MAILDIR_LIB}
 # all compile: ${STATICLIB} ${LTLIB} ${THRSTATICLIB} ${THRLTLIB}
 
 version_info=-version-info `echo ${version} | cut -d. -f1,2 | tr . :`
@@ -111,6 +117,14 @@ ${STATICLIB}: ${OBJS}
        ar crv $@ ${OBJS}
        ranlib $@
 
+${TRIO_LIB}: ${TRIO_OBJS}
+       ar crv $@ ${TRIO_OBJS}
+       ranlib $@
+
+${MAILDIR_LIB}: ${MAILDIR_OBJS}
+       ar crv $@ ${MAILDIR_OBJS}
+       ranlib $@
+
 ${THRSTATICLIB}: ${THROBJS}
        ar crv $@ ${THROBJS}
        ranlib $@
@@ -174,7 +188,7 @@ install:
        if [ x${DOSTAGE} = xyes ]; then \
                mkdir -p ${PREFIX}/include/${globalprefix}/${lbprefix} ; \
                (cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${lbprefix}) ; \
-               install -m 644 ${STATICLIB} ${THRSTATICLIB} ${PREFIX}/lib; \
+               install -m 644 ${STATICLIB} ${THRSTATICLIB} ${TRIO_LIB} ${MAILDIR_LIB} ${PREFIX}/lib; \
        fi
 
 clean:
index d2997c8..e3add29 100755 (executable)
 
        Revision history:
        $Log$
+       Revision 1.7  2005/05/26 15:13:46  zurek
+       inserted module.build.file
+       
+       Revision 1.6.2.1  2005/02/12 01:39:00  glbuild
+       Changed start time
+       
+       Revision 1.6  2004/10/18 19:16:09  zsalvet
+       RPM descriptions
+       
        Revision 1.5  2004/07/28 12:27:00  dimeglio
        Changed default target from compile to dist
        
@@ -90,6 +99,7 @@
                 Load version file 
             ========================================= -->
        <property file="${module.version.file}"/>
+       <property file="${module.build.file}"/>
                
        <!-- ==============================================
                 Local private targets
index 973a2da..9d68ded 100644 (file)
@@ -73,7 +73,7 @@ struct _edg_wll_Context {
 
        int             is_V21;         /* true if old (V21) request arrived */
        int             isProxy;        /* LBProxy */
-       
+
 /* server limits */
        int             softLimit;
        int             hardJobsLimit;
@@ -85,6 +85,9 @@ struct _edg_wll_Context {
        char            *dumpStorage;
        char            *purgeStorage;
 
+/* maildir location */
+       char    *jpreg_dir;
+
 /* flag for function store_event
  * if set then event are loaded from dump file
  */
diff --git a/org.glite.lb.common/interface/lb_maildir.h b/org.glite.lb.common/interface/lb_maildir.h
new file mode 100644 (file)
index 0000000..4c918d4
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef LB_MAILDIR
+#define LB_MAILDIR
+
+/*
+ * Functions for reading and writing messages via
+ * maildir protocol.
+ * Used when registering job to the JP, i.e.
+ */
+
+enum {
+       LBMD_TRANS_OK,
+       LBMD_TRANS_FAILED
+};
+       
+extern char lbm_errdesc[];
+
+extern int edg_wll_MaildirInit(const char *);
+extern int edg_wll_MaildirStoreMsg(const char *, const char *, const char *);
+extern int edg_wll_MaildirTransStart(const char *, char **, char **);
+extern int edg_wll_MaildirTransEnd(const char *, char *, int);
+
+#endif
index 0e4e6cf..0dfbbc8 100644 (file)
@@ -3,7 +3,6 @@
 
 #ident "$Header$"
 
-
 /**
  * \file edg/workload/logging/common/log_proto.h
  * \brief common part of the logging protocol
index 5f91d89..ad6ec55 100644 (file)
@@ -1,4 +1,3 @@
 #Thu May 19 13:15:32 CEST 2005
-module.version=1.4.0
-module.build=2
+module.version=2.0.0
 module.age=1
index 1e37089..7978a9e 100644 (file)
@@ -34,6 +34,7 @@ int edg_wll_InitContext(edg_wll_Context *ctx)
        out->connPoolNotif = (edg_wll_ConnPool *) calloc(1, sizeof(edg_wll_ConnPool));
        out->connProxy = (edg_wll_ConnPool *) calloc(1, sizeof(edg_wll_ConnProxy));
        out->connProxy->conn.sock = -1;
+       out->connToUse = -1;
 
        *ctx = out;
        return 0;
index 3d0861a..4ceee87 100644 (file)
@@ -31,14 +31,14 @@ for my $e (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
 };
 
 /**
- * \fn edg_wll_EventCode edg_wll_StringToEvent(char *name)
+ * \fn edg_wll_EventCode edg_wll_StringToEvent(const char *name)
  * \param name          a string event name (e.g. "JobTransfer")
  * \return corresponding numeric code (edg_wll_EventCode)
  * \brief convert a string event name to the corresponding numeric code  
  * Calls: strcasecmp
  * Algorithm: array lookup
  */
-edg_wll_EventCode edg_wll_StringToEvent(char *name)
+edg_wll_EventCode edg_wll_StringToEvent(const char *name)
 {
        unsigned int    i;
 
@@ -95,14 +95,14 @@ for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
 };
 
 /*
- * \fn edg_wll_KeyNameCode edg_wll_StringToKeyName(char *name)
+ * \fn edg_wll_KeyNameCode edg_wll_StringToKeyName(const char *name)
  * \param name         a string ULM key name (e.g. "DG.JOB.TRANSFER.DEST")
  * \return corresponding numeric code (edg_wll_KeyNameCode)
  * \brief convert a string ULM key name to the corresponding numeric code
  * Calls: strcasecmp
  * Algorithm: array lookup
  */
-edg_wll_KeyNameCode edg_wll_StringToKeyName(char *name)
+edg_wll_KeyNameCode edg_wll_StringToKeyName(const char *name)
 {
        unsigned int    i;
 
@@ -156,11 +156,11 @@ static const char \*${char}\[\] = \{
 # function StringTo:
                gen qq{
 /**
- * \\fn $enum edg_wll_StringTo${c}(char *name)
+ * \\fn $enum edg_wll_StringTo${c}(const char *name)
  * Calls: strcasecmp
  * Algorithm: array lookup
  */
-$enum edg_wll_StringTo${c}(char *name) 
+$enum edg_wll_StringTo${c}(const char *name) 
 \{
        unsigned int    i;
 
@@ -212,11 +212,11 @@ static const char \*${char}\[\] = \{
 # function StringTo:
                        gen qq{
 /**
- * \\fn $enum edg_wll_StringTo${c}(char *name)
+ * \\fn $enum edg_wll_StringTo${c}(const char *name)
  * Calls: strcasecmp
  * Algorithm: array lookup
  */
-$enum edg_wll_StringTo${c}(char *name) 
+$enum edg_wll_StringTo${c}(const char *name) 
 \{
        unsigned int    i;
 
@@ -338,6 +338,12 @@ for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
                if ($ft eq 'string') {
                        gen $indent."\tif (event->$tl.$fn) free(event->$tl.$fn);\n"
                }
+               if ($ft eq 'jobid') {
+                       gen $indent."\tif (event->$tl.$fn) edg_wlc_JobIdFree(event->$tl.$fn);\n"
+               }
+               if ($ft eq 'notifid') {
+                       gen $indent."\tif (event->$tl.$fn) edg_wll_NotifIdFree(event->$tl.$fn);\n"
+               }
        }
        gen $indent.$indent."break;\n"
 }
diff --git a/org.glite.lb.common/src/lb_maildir.c b/org.glite.lb.common/src/lb_maildir.c
new file mode 100644 (file)
index 0000000..4155918
--- /dev/null
@@ -0,0 +1,257 @@
+#include <malloc.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <time.h>
+#include <fcntl.h>
+
+#include "context-int.h"
+#include "lb_maildir.h"
+
+#define DEFAULT_ROOT   "/tmp/lb_maildir"
+
+enum {
+       LBMD_DIR_TMP = 0,
+       LBMD_DIR_NEW,
+       LBMD_DIR_WORK
+};
+
+static const char *dirs[] = { "tmp", "new", "work" };
+
+
+#define MAX_ERR_LEN            1024
+char lbm_errdesc[MAX_ERR_LEN];
+
+
+static int check_mkdir(const char *dir)
+{
+       struct stat sbuf;
+
+       if ( stat(dir, &sbuf) ) {
+               if ( errno == ENOENT ) {
+                       if ( mkdir(dir, S_IRWXU) ) return 1;
+               }
+               else return 1;
+       }
+       else if (S_ISDIR(sbuf.st_mode)) return 0;
+       else return 1;
+
+       return 0;
+}
+
+
+int edg_wll_MaildirInit(
+       const char                 *dir)
+{
+       const char *root = dir? : DEFAULT_ROOT;
+       char            dirname[PATH_MAX];
+       int                     i;
+
+       if ( check_mkdir(root) ) {
+               snprintf(lbm_errdesc, MAX_ERR_LEN, "%s: %s\n", root, strerror(errno));
+               return 1;
+       }
+       
+       for ( i = 0; i < sizeof(dirs)/sizeof((dirs)[0]); i++ ) {
+               snprintf(dirname, PATH_MAX, "%s/%s", root, dirs[i]);
+               if ( check_mkdir(dirname) ) {
+                       snprintf(lbm_errdesc, MAX_ERR_LEN, "%s: %s\n", dirname, strerror(errno));
+                       return 1;
+               }
+       }
+
+       return 0;
+}
+
+
+int edg_wll_MaildirStoreMsg(
+       const char                 *root,
+       const char                 *srvname,
+       const char         *msg)
+{
+       char            fname[PATH_MAX],
+                               newfname[PATH_MAX];
+       int                     fhnd,
+                               written,
+                               msgsz,
+                               ct, i;
+
+
+       if ( !root ) root = DEFAULT_ROOT;
+
+       errno = 0;
+       i = 0;
+       while ( 1 ) {
+               if ( ++i > 10 ) {
+                       errno = ECANCELED;
+                       snprintf(lbm_errdesc, MAX_ERR_LEN, "Maximum tries limit reached with unsuccessful file creation");
+                       return -1;
+               }
+               snprintf(fname, PATH_MAX, "%s/%s/%ld.%d.%s", root, dirs[LBMD_DIR_TMP], time(NULL), getpid(), srvname);
+               if ( (fhnd = open(fname, O_CREAT|O_EXCL|O_WRONLY, 00600)) < 0 ) {
+                       if ( errno == EEXIST ) { sleep(2); continue; }
+                       snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't create file %s", fname);
+                       return -1;
+               }
+               break;
+       }
+
+       msgsz = strlen(msg);
+       written = 0;
+       while ( written < msgsz ) {
+               if ( (ct = write(fhnd, msg+written, msgsz-written)) < 0 ) {
+                       if ( errno == EINTR ) { errno = 0; continue; }
+                       snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't write into file %s", fname);
+                       return -1;
+               }
+               written += msgsz;
+       }
+       if ( fsync(fhnd) ) {
+               snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't fsync file %s", fname);
+               return -1;
+       }
+       if ( close(fhnd) ) {
+               snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't close file %s", fname);
+               return -1;
+       }
+       snprintf(newfname, PATH_MAX, "%s/%s/%s", root, dirs[LBMD_DIR_NEW], strrchr(fname, '/')+1);
+       if ( link(fname, newfname) ) {
+               snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't link new file %s", newfname);
+               return -1;
+       }
+
+       return 0;
+}
+
+
+int edg_wll_MaildirTransEnd(
+       const char                 *root,
+       char                       *fname,
+       int                                     tstate)
+{
+       char            workfname[PATH_MAX],
+                               newfname[PATH_MAX],
+                               origfname[PATH_MAX];
+       struct stat     st;
+
+
+       if ( !root ) root = DEFAULT_ROOT;
+
+       snprintf(workfname, PATH_MAX, "%s/%s/%s", root, dirs[LBMD_DIR_WORK], fname);
+       unlink(workfname);
+
+       snprintf(origfname, PATH_MAX, "%s/%s/%s", root, dirs[LBMD_DIR_TMP], fname);
+       if ( tstate == LBMD_TRANS_OK ) {
+               unlink(origfname);
+               return 0;
+       }
+
+       if ( stat(origfname, &st) ) {
+               snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't stat file '%s'", origfname);
+               return -1;
+       }
+
+       snprintf(newfname, PATH_MAX, "%s/%s/%s", root, dirs[LBMD_DIR_NEW], fname);
+       if ( link(origfname, newfname) ) {
+               snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't link new file %s", newfname);
+               return -1;
+       }
+
+       return 0;
+}
+
+
+int edg_wll_MaildirTransStart(
+       const char                 *root,
+       char              **msg,
+       char                      **fname)
+{
+       static DIR         *dir = NULL;
+       struct dirent  *ent;
+       char                    newfname[PATH_MAX],
+                                       oldfname[PATH_MAX],
+                                  *buf = NULL;
+       int                             fhnd,
+                                       toread, ct,
+                                       bufsz, bufuse;
+
+
+       if ( !root ) root = DEFAULT_ROOT;
+
+       if ( !dir ) {
+               char    dirname[PATH_MAX];
+               snprintf(dirname, PATH_MAX, "%s/%s", root, dirs[LBMD_DIR_NEW]);
+               if ( !(dir = opendir(dirname)) ) {
+                       snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't open directory '%s'", root);
+                       goto err;
+               }
+       }
+
+       do {
+               errno = 0;
+               if ( !(ent = readdir(dir)) ) {
+                       if ( errno == EBADF ) {
+                               snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't read directory '%s'", root);
+                               dir = NULL;
+                               goto err;
+                       } else {
+                               closedir(dir);
+                               dir = NULL;
+                               return 0;
+                       }
+               }
+               if ( ent->d_name[0] == '.' ) continue;
+               snprintf(newfname, PATH_MAX, "%s/%s/%s", root, dirs[LBMD_DIR_WORK], ent->d_name);
+               snprintf(oldfname, PATH_MAX, "%s/%s/%s", root, dirs[LBMD_DIR_NEW], ent->d_name);
+               if ( rename(oldfname, newfname) ) {
+                       if ( errno == ENOENT ) {
+                               /* maybe some other instance moved this file away... */
+                               continue;
+                       } else {
+                               snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't move file '%s'", oldfname);
+                               goto err;
+                       }
+               } else {
+                       /* we have found and moved the file with which we will work now */
+                       break;
+               }
+       } while ( 1 );
+
+       if ( (fhnd = open(newfname, O_RDONLY)) < 0 ) {
+               snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't open file '%s'", newfname);
+               goto err;
+       }
+
+       bufuse = bufsz = toread = ct = 0;
+       do {
+               errno = 0;
+               if ( bufuse == bufsz ) {
+                       char *tmp = realloc(buf, bufsz+BUFSIZ);
+                       if ( !tmp ) goto err;
+                       buf = tmp;
+                       bufsz += BUFSIZ;
+               }
+               toread = bufsz - bufuse;
+               if ( (ct = read(fhnd, buf+bufuse, toread)) < 0 ) {
+                       if ( errno == EINTR ) continue;
+                       snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't read file '%s'", newfname);
+                       goto err;
+               }
+               if ( ct == 0 ) break;
+               bufuse += ct;
+       } while ( ct == toread );
+       close(fhnd);
+
+       if ( !(*fname = strdup(ent->d_name)) ) goto err;
+       *msg = buf;
+       return 1;
+
+
+err:
+       if ( buf ) free(buf);
+
+       return -1;
+}
index d6adc91..324b56d 100644 (file)
@@ -219,7 +219,7 @@ int edg_wll_log_event_send(
                                sleep(timeout->tv_sec);
                                continue;
                        } else {
-                               edg_wll_SetError(ctx, errno, "connect()"); 
+                               edg_wll_SetError(ctx, errno, "Can't connect to the interlogger"); 
                                goto cleanup;
                        }
                } else break;
index 001261c..b649fe4 100644 (file)
@@ -19,56 +19,70 @@ static const char *myenv[] = {
        NULL,
        NULL,
        NULL,
-       "EDG_WL_LOG_DESTINATION",
-       "EDG_WL_LOG_DESTINATION",
-       "EDG_WL_LOG_TIMEOUT",
-       "EDG_WL_LOG_SYNC_TIMEOUT",
-       "EDG_WL_QUERY_SERVER",
-       "EDG_WL_QUERY_SERVER",
-       "EDG_WL_QUERY_SERVER_OVERRIDE",
-       "EDG_WL_QUERY_TIMEOUT",
-       "EDG_WL_QUERY_JOBS_LIMIT",
-       "EDG_WL_QUERY_EVENTS_LIMIT",
-       "EDG_WL_QUERY_RESULTS",
-       "EDG_WL_QUERY_CONNECTIONS",
-       "EDG_WL_NOTIF_SERVER",
-       "EDG_WL_NOTIF_SERVER",
-       "EDG_WL_NOTIF_TIMEOUT",
+       "%sLOG_DESTINATION",
+       "%sLOG_DESTINATION",
+       "%sLOG_TIMEOUT",
+       "%sLOG_SYNC_TIMEOUT",
+       "%sQUERY_SERVER",
+       "%sQUERY_SERVER",
+       "%sQUERY_SERVER_OVERRIDE",
+       "%sQUERY_TIMEOUT",
+       "%sQUERY_JOBS_LIMIT",
+       "%sQUERY_EVENTS_LIMIT",
+       "%sQUERY_RESULTS",
+       "%sQUERY_CONNECTIONS",
+       "%sNOTIF_SERVER",
+       "%sNOTIF_SERVER",
+       "%sNOTIF_TIMEOUT",
 /* don't care about X509_USER_*, GSI looks at them anyway */
        NULL,
        NULL,
        NULL,
-       "EDG_WL_LBPROXY_STORE_SOCK",
-       "EDG_WL_LBPROXY_SERVE_SOCK",
-       "EDG_WL_LBPROXY_USER",
+       "%sLBPROXY_STORE_SOCK",
+       "%sLBPROXY_SERVE_SOCK",
+       "%sLBPROXY_USER",
+       "%sJPREG_TMPDIR",
 };
 
 /* XXX: does not parse URL, just hostname[:port] */
 
-static int extract_port(edg_wll_ContextParam param,int dflt)
+static char *mygetenv(int param)
 {
-       char    *p = NULL,*s = NULL;
+       char    *s = NULL;
+
        if (myenv[param]) {
-               s = getenv(myenv[param]);
-               if (s) p = strchr(s,':');
+               char    varname[100];
+
+               sprintf(varname,myenv[param],"GLITE_WMS_");
+               s = getenv(varname);
+
+               if (!s) {
+                       sprintf(varname,myenv[param],"EDG_WL_");
+                       s = getenv(varname);
+               }
        }
+       return s;
+}
+
+static int extract_port(edg_wll_ContextParam param,int dflt)
+{
+       char    *p = NULL,*s = mygetenv(param);
+
+        if (s) p = strchr(s,':');
        return  p ? atoi(p+1) : dflt;
 }
 
 static int extract_num(edg_wll_ContextParam param,int dflt)
 {
-       if (myenv[param]) {
-               char *s = getenv(myenv[param]);
-               if (s) return(atoi(s));
-       }
-       return dflt;
+       char *s = mygetenv(param);
+       return s ? atoi(s) : dflt;
 }
 
 static char *extract_host(edg_wll_ContextParam param,const char *dflt)
 {
        char    *p,*s = NULL;
 
-       if (myenv[param]) s = getenv(myenv[param]);
+       s = mygetenv(param);
        if (!s && !dflt) return NULL;
        s = strdup(s?s:dflt),
        p = strchr(s,':');
@@ -81,7 +95,7 @@ static void extract_time(edg_wll_ContextParam param,double dflt,struct timeval *
        char    *s = NULL;
        double  d;
 
-       if (myenv[param]) s = getenv(myenv[param]);
+       s = mygetenv(param);
        d = s ? atof(s) : dflt;
        t->tv_sec = (long) d;
        t->tv_usec = (long) ((d-t->tv_sec)*1e6);
@@ -92,8 +106,7 @@ static char *extract_split(edg_wll_ContextParam param,char by,int index)
        int     i;
        char    *s,*e;
 
-       if (!myenv[param]) return NULL;
-       if (!(s = getenv(myenv[param]))) return NULL;
+       if (!(s = mygetenv(param))) return NULL;
        for (i=0; i<index && (s=strchr(s,by));i++) s++;
        return i==index ? ( (e = strchr(s,by)) ? strndup(s,e-s) : strdup(s))
                        : NULL;
@@ -139,7 +152,7 @@ int edg_wll_SetParamString(edg_wll_Context ctx,edg_wll_ContextParam param,const
                        ctx->p_cert_filename = val ? strdup(val) : NULL;
                        break;
                case EDG_WLL_PARAM_QUERY_SERVER_OVERRIDE:
-                       if (!val) val = getenv(myenv[param]);
+                       if (!val) val = mygetenv(param);
                        if (!val) val = "no";
                        ctx->p_query_server_override = !strcasecmp(val,"yes");
                        break;
@@ -160,6 +173,11 @@ int edg_wll_SetParamString(edg_wll_Context ctx,edg_wll_ContextParam param,const
                        free(ctx->p_user_lbproxy);
                        ctx->p_user_lbproxy = val ? strdup(val) : NULL;
                        break;
+               case EDG_WLL_PARAM_JPREG_TMPDIR:
+                       if (!val) val = getenv(myenv[param]);
+                       free(ctx->jpreg_dir);
+                       ctx->jpreg_dir = val ? strdup(val) : NULL;
+                       break;
                default:
                        return edg_wll_SetError(ctx,EINVAL,"unknown parameter");
        }
@@ -212,7 +230,7 @@ int edg_wll_SetParamInt(edg_wll_Context ctx,edg_wll_ContextParam param,int val)
                        break;
                case EDG_WLL_PARAM_QUERY_CONNECTIONS:
                        {
-                               char *s = getenv(myenv[param]);
+                               char *s = mygetenv(param);
                                
                                if (!val && s) val = atoi(s);
                                ctx->poolSize = val ? val : EDG_WLL_LOG_CONNECTIONS_DEFAULT;
@@ -299,6 +317,7 @@ int edg_wll_SetParam(edg_wll_Context ctx,edg_wll_ContextParam param,...)
                case EDG_WLL_PARAM_LBPROXY_STORE_SOCK:
                case EDG_WLL_PARAM_LBPROXY_SERVE_SOCK:
                case EDG_WLL_PARAM_LBPROXY_USER:
+               case EDG_WLL_PARAM_JPREG_TMPDIR:
                        return edg_wll_SetParamString(ctx,param,va_arg(ap,char *));
                case EDG_WLL_PARAM_LOG_TIMEOUT:      
                case EDG_WLL_PARAM_LOG_SYNC_TIMEOUT: 
@@ -408,6 +427,10 @@ int edg_wll_GetParam(edg_wll_Context ctx,edg_wll_ContextParam param,...)
                        p_string = va_arg(ap, char **);
                        *p_string = estrdup(ctx->p_user_lbproxy);
                        break;
+               case EDG_WLL_PARAM_JPREG_TMPDIR:
+                       p_string = va_arg(ap, char **);
+                       *p_string = estrdup(ctx->jpreg_dir);
+                       break;
                case EDG_WLL_PARAM_LOG_TIMEOUT:      
                        p_tv = va_arg(ap,struct timeval *);
                        *p_tv = ctx->p_log_timeout;
index 4b2e2bd..cf265ff 100644 (file)
@@ -320,6 +320,8 @@ static void startJobStatus(void *data, const char *el, const char **attr)
 
                case 1 : if (!strcmp("user_tags", el) || !strcmp("user_values", el) 
                                || !strcmp("children_hist", el) ||  !strcmp("stateEnterTimes", el)
+                               || !strcmp("possible_destinations", el) 
+                               || !strcmp("possible_ce_nodes", el)
                                || !strcmp("children_states", el) || !strcmp("children", el)) {
                                XMLCtx->stat_begin = XML_GetCurrentByteIndex(XMLCtx->p);
                         }
@@ -937,6 +939,22 @@ static void endJobStat(void *data, const char *el)
                        "children_hist",(int (*)()) edg_wll_StringToStat, &XMLCtx->jobStatSingleGlobal.children_hist);
                XMLCtx->stat_begin = 0;
            }
+                   else if (!strcmp(el,"possible_destinations")) {
+               long len = (XML_GetCurrentByteIndex(XMLCtx->p) + XML_GetCurrentByteCount(XMLCtx->p))
+                               -  XMLCtx->stat_begin;
+
+               edg_wll_ParseStrList(XMLCtx->ctx, XMLCtx->message_body + XMLCtx->stat_begin, len,
+                       "possible_destinations", "name", &XMLCtx->jobStatSingleGlobal.possible_destinations);
+               XMLCtx->stat_begin = 0;
+            }
+                   else if (!strcmp(el,"possible_ce_nodes")) {
+               long len = (XML_GetCurrentByteIndex(XMLCtx->p) + XML_GetCurrentByteCount(XMLCtx->p))
+                               -  XMLCtx->stat_begin;
+
+               edg_wll_ParseStrList(XMLCtx->ctx, XMLCtx->message_body + XMLCtx->stat_begin, len,
+                       "possible_ce_nodes", "name", &XMLCtx->jobStatSingleGlobal.possible_ce_nodes);
+               XMLCtx->stat_begin = 0;
+            }
                    else if (!strcmp(el,"children")) {
                long len = (XML_GetCurrentByteIndex(XMLCtx->p) + XML_GetCurrentByteCount(XMLCtx->p))
                                -  XMLCtx->stat_begin;
@@ -2889,10 +2907,10 @@ int edg_wll_StatsRequestToXML(
                 char **message)
 {
        char *pomA=NULL, *pomB=NULL, *pomC=NULL;
-       edg_wll_QueryRec **conditions;
+       const edg_wll_QueryRec **conditions;
 
        
-        conditions = (edg_wll_QueryRec **) malloc(2 * sizeof(edg_wll_QueryRec *));
+        conditions = (const edg_wll_QueryRec **) malloc(2 * sizeof(edg_wll_QueryRec *));
         conditions[1] = NULL;
 
        conditions[0] = cond;