Build warnings fixed.
authorZdeněk Šustr <sustr4@cesnet.cz>
Fri, 19 Mar 2010 12:37:51 +0000 (12:37 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Fri, 19 Mar 2010 12:37:51 +0000 (12:37 +0000)
21 files changed:
org.glite.lb.client/examples/multiple_user_jobs.c
org.glite.lb.client/examples/query_ext.c
org.glite.lb.client/examples/stresslog.c
org.glite.lb.client/examples/test_changed_jdl.c
org.glite.lb.client/src/logevent.c.T
org.glite.lb.common/src/lb_perftest.c
org.glite.lb.logger/src/event_store.c
org.glite.lb.logger/src/input_queue_socket.c
org.glite.lb.logger/src/logd_proto.c
org.glite.lb.logger/src/queue_mgr.c
org.glite.lb.logger/src/queue_thread.c
org.glite.lb.logger/src/recover.c
org.glite.lb.logger/src/send_event.c
org.glite.lb.logger/src/server_msg.c
org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/get_events.c.T
org.glite.lb.server/src/index.c.T
org.glite.lb.server/src/jobstat.c
org.glite.lb.server/src/lb_html.h
org.glite.lb.server/src/lb_rss.c
org.glite.lb.server/src/store.c.T

index 1bb4da9..d11e9bd 100644 (file)
@@ -25,7 +25,7 @@ limitations under the License.
 
 int use_proxy = 0;
 
-int (*user_jobs)(edg_wll_Context, edg_wlc_JobId **, edg_wll_JobStat **);
+int (*user_jobs)(edg_wll_Context, glite_jobid_t **, edg_wll_JobStat **);
 
 
 void
@@ -56,7 +56,7 @@ int main(int argc,char **argv)
        no_of_runs = argc-1;
 
        p_ctx = (edg_wll_Context*) calloc (sizeof(edg_wll_Context), no_of_runs);
-       jobs = (edg_wlc_JobId**) calloc (sizeof(edg_wlc_JobId*), no_of_runs);
+       jobs = (glite_jobid_t**) calloc (sizeof(glite_jobid_t*), no_of_runs);
        states = (edg_wll_JobStat**) calloc (sizeof(edg_wll_JobStat*), no_of_runs);
 
        user_jobs = edg_wll_UserJobs;
@@ -73,7 +73,7 @@ int main(int argc,char **argv)
                printf("Jobs retrieved using file No. %d (%s)\n"
                        "------------------------------------------\n", k + 1, argv[k + 1]);
                for (i=0; states[k][i].state != EDG_WLL_JOB_UNDEF; i++) {       
-                       char *id = edg_wlc_JobIdUnparse(states[k][i].jobId),
+                       char *id = glite_jobid_unparse(states[k][i].jobId),
                             *st = edg_wll_StatToString(states[k][i].state);
                        
                        if (!states[k][i].parent_job) {
@@ -85,10 +85,10 @@ int main(int argc,char **argv)
                                        printf("%s  %s .... %s %s\n", (states[k][i].jobtype==EDG_WLL_STAT_DAG)?"DAG ":"COLL",id, st, (states[k][i].state==EDG_WLL_JOB_DONE) ? edg_wll_done_codeToString(states[k][i].done_code) : "");
                                        for (j=0; states[k][j].state != EDG_WLL_JOB_UNDEF; j++) {
                                                if (states[k][j].parent_job) {
-                                                       char *par_id = edg_wlc_JobIdUnparse(states[k][j].parent_job);
+                                                       char *par_id = glite_jobid_unparse(states[k][j].parent_job);
                                                        
                                                        if (!strcmp(id,par_id)) {
-                                                               char *sub_id = edg_wlc_JobIdUnparse(states[k][j].jobId),
+                                                               char *sub_id = glite_jobid_unparse(states[k][j].jobId),
                                                                     *sub_st = edg_wll_StatToString(states[k][j].state);
                                                                
                                                                printf(" `-       %s .... %s %s\n", sub_id, sub_st, (states[k][j].state==EDG_WLL_JOB_DONE) ? edg_wll_done_codeToString(states[k][j].done_code) : "");
@@ -112,7 +112,7 @@ err:
        if  (jobs) {
                for (k=0; k < no_of_runs; k++) {
                        if (jobs[k])
-                               for (i=0; jobs[k][i]; i++)  edg_wlc_JobIdFree(jobs[i]); 
+                               for (i=0; jobs[k][i]; i++)  glite_jobid_free(*jobs[i]); 
                }
                free(jobs);
        }
index 2eda64f..3443d33 100644 (file)
@@ -295,7 +295,7 @@ static void free_QueryRec(edg_wll_QueryRec *qr)
        {
        case EDG_WLL_QUERY_ATTR_JOBID:
        case EDG_WLL_QUERY_ATTR_PARENT:
-               edg_wlc_JobIdFree(qr->value.j);
+               glite_jobid_free((glite_jobid_t)qr->value.j);
                break;
 
        case EDG_WLL_QUERY_ATTR_STATUS:
@@ -438,7 +438,7 @@ static char *get_job_condition(char *src, edg_wll_QueryRec *cond)
        {
        case EDG_WLL_QUERY_ATTR_JOBID:
        case EDG_WLL_QUERY_ATTR_PARENT:
-               if ( edg_wlc_JobIdParse(tmps, &cond->value.j) )
+               if ( glite_jobid_parse(tmps, (glite_jobid_t *)&cond->value.j) )
                {
                        fprintf(stderr,"%s: %s: cannot parse jobId\n", myname, tmps);
                        return NULL;
@@ -801,6 +801,7 @@ static void printconds(edg_wll_QueryRec **cond)
                        case EDG_WLL_QUERY_OP_LESS: printf("<"); break;
                        case EDG_WLL_QUERY_OP_GREATER: printf(">"); break;
                        case EDG_WLL_QUERY_OP_WITHIN: printf("@"); break;
+                       case EDG_WLL_QUERY_OP_CHANGED: printf("->"); break;
                        }
                        switch ( cond[i][j].attr )
                        {
index ae84971..0b58200 100644 (file)
@@ -36,8 +36,7 @@ extern char *optarg;
 extern int opterr,optind;
 
 extern int edg_wll_DoLogEvent(edg_wll_Context context, edg_wll_LogLine logline);
-extern int edg_wll_DoLogEventProxy(edg_wll_Context context, edg_wll_LogLine logline);
-extern int edg_wll_DoLogEventDirect(edg_wll_Context context, edg_wll_LogLine logline);
+extern int edg_wll_DoLogEventServer(edg_wll_Context context, int flags,edg_wll_LogLine logline);
 
 static const char *me;
 
index 4b262d9..3d97bd6 100644 (file)
@@ -23,7 +23,8 @@ limitations under the License.
 int main(int argc,char **argv)
 {
        edg_wll_Context ctx;
-       edg_wll_QueryRec        chj[2], chs[2], *ch2[3] = { chj, chs, NULL };
+       edg_wll_QueryRec        chj[2], chs[2];
+       const edg_wll_QueryRec const    *ch2[3] = { chj, chs, NULL };
        char    *et,*ed;
        edg_wll_NotifId id;
        edg_wll_JobStat stat;
index c5758be..c5dbe41 100644 (file)
@@ -34,6 +34,8 @@ limitations under the License.
 #include "glite/jobid/cjobid.h"
 #include "glite/lb/notifid.h"
 #include "glite/lb/events.h"
+#include "glite/lb/context.h"
+#include "glite/lb/context-int.h"
 
 #include "producer.h"
 #include "args.h"
index f7fe97e..cfc46a5 100644 (file)
@@ -34,6 +34,7 @@ limitations under the License.
 
 #include "lb_perftest.h"
 #include "il_msg.h"
+#include "context-int.h"
 
 typedef struct {
   char *event;
index 7683640..c12623e 100644 (file)
@@ -26,9 +26,7 @@ limitations under the License.
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <fcntl.h>
 #include <sys/param.h>
 
@@ -247,19 +245,6 @@ event_store_create(char *job_id_s, const char *filename)
 
 static
 int
-event_store_lock_ro(struct event_store *es)
-{
-  assert(es != NULL);
-
-  if(pthread_rwlock_rdlock(&es->commit_lock))
-    abort();
-
-  return(0);
-}
-
-
-static
-int
 event_store_lock(struct event_store *es)
 {
   assert(es != NULL);
@@ -427,7 +412,7 @@ event_store_rotate_file(struct event_store *es)
        for(num = 0; num < 256; num++) {
                struct stat st;
 
-               snprintf(newname, MAXPATHLEN, "%s.%d%03d", es->event_file_name, timestamp, num);
+               snprintf(newname, MAXPATHLEN, "%s.%d%03d", es->event_file_name, (int) timestamp, num);
                newname[MAXPATHLEN] = 0;
                if(stat(newname, &st) < 0) {
                        if(errno == ENOENT) {
@@ -501,6 +486,7 @@ event_store_recover_jobid(struct event_store *es)
        return 0;
 }
 
+#if defined(IL_NOTIFICATIONS)
 static
 int
 cmp_jobid(struct server_msg *msg, void *data)
@@ -531,6 +517,7 @@ cmp_jobid_set_exp(struct server_msg *msg, void *data)
        }
        return 0;
 }
+#endif
 
 /*
  * event_store_recover()
@@ -930,48 +917,6 @@ event_store_sync(struct event_store *es, long offset)
   ret = event_store_recover_jobid(es);
   ret = (ret < 0) ? ret : 0;
   return(ret);
-
-#if 0
-  event_store_lock_ro(es);
-  if(es->offset == offset)
-    /* we are up to date */
-    ret = 1;
-  else if(es->offset > offset)
-    /* we have already seen this event */
-    ret = 0;
-  else {
-    /* es->offset < offset, i.e. we have missed some events */
-    event_store_unlock(es);
-    ret = event_store_recover(es);
-    /* XXX possible room for intervention by another thread - is there
-     * any other thread messing with us?
-     * 1) After recover() es->offset is set at the end of file.
-     * 2) es->offset is set only by recover() and next().
-     * 3) Additional recover can not do much harm.
-     * 4) And next() is only called by the same thread as sync().
-     * 5) use_lock is in place, so no cleanup possible
-      * => no one is messing with us right now */
-    event_store_lock_ro(es);
-    if(ret < 0)
-      ret = -1;
-    else
-           if(es->offset <= offset) {
-                   /* Apparently there is something wrong - we are receiving an event
-                    * which is beyond the end of file. Someone must have removed the file
-                    * when we were not looking. The question is - what should we do with the event?
-                    * We have to send it, as this is the only one occasion when we see it.
-                    * However, we must not allow the es->offset to be set using this event,
-                    * as it would point after the end of file. Sort this out in event_store_next().
-                    */
-                   ret = 1;
-           } else if(es->offset > offset) {
-                   /* we have seen at least this event */
-                   ret = 0;
-           }
-  }
-  event_store_unlock(es);
-  return(ret);
-#endif
 }
 
 
@@ -980,25 +925,11 @@ event_store_next(struct event_store *es, long offset, int len)
 {
   assert(es != NULL);
 
-  /* Commented out due to the fact that offset as received on socket
+  /* offset as received on socket
    * has little to do with real event file at the moment. es->offset
    * handling is left solely to the event_store_recover().
    */
 
-#if 0
-  event_store_lock(es);
-  /* Whoa, be careful now. The es->offset points right after the last enqueued event,
-   * but it may not be the offset of the event WE have just enqueued, because:!
-   *  1) someone could have removed the event file behind our back
-   *  2) the file could have been recover()ed and more events read
-   * In either case the offset should not be moved.
-   */
-  if(es->offset == offset) {
-         es->offset += len;
-  }
-  event_store_unlock(es);
-#endif
-
   return(0);
 }
 
@@ -1078,7 +1009,7 @@ event_store_clean(struct event_store *es)
     return(0);
   }
 
-  if(fd = pthread_rwlock_wrlock(&es->offset_lock)) {
+  if((fd = pthread_rwlock_wrlock(&es->offset_lock)) != 0) {
          abort();
   }
 
@@ -1321,8 +1252,6 @@ event_store_from_file(char *filename)
 #if defined(IL_NOTIFICATIONS)
        edg_wll_Event *notif_event;
        edg_wll_Context context;
-       char *dest_name = NULL;
-
 #endif
 
        glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO, 
@@ -1366,6 +1295,7 @@ event_store_from_file(char *filename)
        /*  XXX: what was that good for?
        if(notif_event->notification.dest_host &&
           (strlen(notif_event->notification.dest_host) > 0)) {
+               char *dest_name = NULL;
                asprintf(&dest_name, "%s:%d", notif_event->notification.dest_host, notif_event->notification.dest_port);
        }
        */
index ad12fb8..f7b60ab 100644 (file)
@@ -95,7 +95,6 @@ read_event(int sock, long *offset, il_octet_string_t *msg)
 {
   char *buffer, *p, *n;
   int  len, alen, i, chunk_size = DEFAULT_CHUNK_SIZE;
-  static char buf[1024];
 
   msg->data = NULL;
   msg->len = 0;
@@ -128,7 +127,6 @@ read_event(int sock, long *offset, il_octet_string_t *msg)
         (alen - (p - buffer)) is the free space,
   */ 
  
-#if 1
   /* Reading events - optimized version. Attempts to increase chunks read by recv
    * when there are more data, reads directly into destination memory (instead of 
    * copying from static buffer) etc.
@@ -172,55 +170,6 @@ read_event(int sock, long *offset, il_octet_string_t *msg)
          }
   } while ( (len > 0) && (n == NULL) );
 
-#else
-  /* Reading events - original version.
-   * Appears to behave quite good, anyway.
-   */
-  while((len=recv(sock, buf, sizeof(buf), MSG_PEEK | MSG_NOSIGNAL)) > 0) {
-
-    /* we have to be prepared for sizeof(buf) bytes */
-    if(alen - (p - buffer) < (int)sizeof(buf)) {
-      alen += 8192;
-      n = realloc(buffer, alen);
-      if(n == NULL) {
-       free(buffer);
-       set_error(IL_NOMEM, ENOMEM, "read_event: no room for event");
-       return(-1);
-      }
-      p = p - buffer + n;
-      buffer = n;
-    }
-
-    /* copy all relevant bytes from buffer */
-    n = (char*)memccpy(p, buf, EVENT_SEPARATOR, len);
-    if(n) {
-           /* separator found */
-           n--; /* but do not preserve it */
-           i = n - p;
-           p = n;
-    } else {
-           /* separator not found */
-           i = len;
-           p += len;
-    }
-   /* This was definitely slowing us down:
-    *    for(i=0; (i < len) && (buf[i] != EVENT_SEPARATOR); i++) 
-    *    *p++ = buf[i];
-    */
-
-    /* remove the data from queue */
-    if(i > 0) 
-      if(recv(sock, buf, i, MSG_NOSIGNAL) != i) {
-       set_error(IL_SYS, errno, "read_event: error reading data");
-       free(buffer);
-       return(-1);
-      }
-    if(i < len)
-      /* the event is complete */
-      break;
-  }
-#endif
-
   /* terminate buffer */
   *p = 0;
 
index 8a2adfb..3e766d6 100644 (file)
@@ -336,10 +336,8 @@ int edg_wll_log_proto_server(edg_wll_GssConnection *con, struct timeval *timeout
        int     i,answer,answer_sent;
        int     msg_sock;
        char    *msg,*msg_begin;
-       FILE    *outfile;
-       int     filedesc,filelock_status,flags;
+       int     filedesc,filelock_status;
        long    filepos;
-       struct flock filelock;
        int     priority;
        long    lllid;
        int     unique;
index c6b05c1..ac05324 100644 (file)
@@ -20,6 +20,7 @@ limitations under the License.
 #include <string.h>
 #include <errno.h>
 #include <assert.h>
+#include <stdio.h>
 
 #include "glite/jobid/cjobid.h"
 #include "glite/lb/context.h"
@@ -35,7 +36,9 @@ struct queue_list {
 #endif
 };
 
+#if !defined(IL_NOTIFICATIONS)
 static struct event_queue *log_queue;
+#endif
 static struct queue_list  *queues;
 
 
index 9e4aaac..bc72ae1 100644 (file)
@@ -21,6 +21,7 @@ limitations under the License.
 #include <assert.h>
 #include <errno.h>
 #include <signal.h>
+#include <unistd.h>
 
 #include "interlogd.h"
 
index efe5ea2..716f4c7 100644 (file)
@@ -18,6 +18,7 @@ limitations under the License.
 
 
 #include <stdio.h>
+#include <unistd.h>
 #include <assert.h>
 #include <errno.h>
 
index 4dcd14c..a263c85 100644 (file)
@@ -20,9 +20,7 @@ limitations under the License.
 #include <assert.h>
 #include <errno.h>
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -153,7 +151,7 @@ get_reply(struct event_queue *eq, char **buf, int *code_min)
 {
   char *msg=NULL;
   int ret, code;
-  int len, l;
+  int len;
   struct timeval tv;
   struct reader_data data;
 
index 55a6371..aa57e1a 100644 (file)
@@ -20,6 +20,7 @@ limitations under the License.
 #include <errno.h>
 #include <assert.h>
 #include <string.h>
+#include <stdio.h>
 
 #include "interlogd.h"
 #include "glite/lb/il_msg.h" 
@@ -74,9 +75,7 @@ create_msg(il_octet_string_t *ev, char **buffer, long *receipt, time_t *expires)
   }
 #endif
 
-  if(p = strstr(event, "DG.EXPIRES")) {
-         int n;
-
+  if((p = strstr(event, "DG.EXPIRES")) != NULL) {
          p += 11;
          *expires = atoi(p);
   }
index d071741..a35daf9 100644 (file)
@@ -89,7 +89,6 @@ enum lb_srv_perf_sink sink_mode;
 #endif /* GLITE_LB_SERVER_WITH_WS */
 
 extern int edg_wll_StoreProto(edg_wll_Context ctx);
-extern int edg_wll_StoreProtoProxy(edg_wll_Context ctx);
 
 extern char *lbproxy_ilog_socket_path;
 extern char *lbproxy_ilog_file_prefix;
@@ -1738,25 +1737,6 @@ static int wait_for_open(edg_wll_Context ctx, const char *dbstring)
        return err;
 }
 
-#if 0
-static void free_hostent(struct hostent *h){
-       int i;
-
-       if (h) {
-               if (h->h_name) free(h->h_name);
-               if (h->h_aliases) {
-                       for (i=0; h->h_aliases[i]; i++) free(h->h_aliases[i]);
-                       free(h->h_aliases);
-               }
-               if (h->h_addr_list) {
-                       for (i=0; h->h_addr_list[i]; i++) free(h->h_addr_list[i]);
-                       free(h->h_addr_list);
-               }
-               free(h);
-       }
-}
-#endif
-
 struct asyn_result {
        char            *host;
        char            *service;
index 72e4796..3f51578 100644 (file)
@@ -38,6 +38,7 @@ limitations under the License.
 #include "get_events.h"
 #include "glite/lb/context-int.h"
 #include "glite/lb/events_parse.h"
+#include "glite/lb/ulm_parse.h"
 #include "db_supp.h"
 
 static void edg_wll_set_event_field(edg_wll_Event *,char *,char *);
index e8223b5..46057b9 100644 (file)
@@ -138,7 +138,7 @@ static int parse_indices(edg_wll_Context ctx,char **keys,char ***column_names,co
                                free(ed);
                                return code;
                        }
-#warning: TODO: needed Sub_part in value???
+// XXX: needed Sub_part in value???
 //                            else idx[nkeys][j].value.i = atoi(showcol[Sub_part]);
                }
                nkeys++;
index fcd9130..de5f3d0 100644 (file)
@@ -515,8 +515,8 @@ int edg_wll_intJobStatus(
                                intErr = 1; break;
                        }
                        ts = events[i].any.timestamp;
-                       if (!mints.tv_sec && !mints.tv_usec
-                           || ts.tv_sec < mints.tv_sec
+                       if ((!mints.tv_sec && !mints.tv_usec)
+                           || (ts.tv_sec < mints.tv_sec)
                            || (ts.tv_sec == mints.tv_sec && ts.tv_usec < mints.tv_usec)) mints = ts;
                }
                /* no events or status computation error */
index 014dea1..e5c4eeb 100644 (file)
@@ -32,5 +32,6 @@ int edg_wll_UserInfoToHTML(edg_wll_Context, edg_wlc_JobId *, char **);
 int edg_wll_UserNotifsToHTML(edg_wll_Context ctx, char **notifids, char **message);
 int edg_wll_NotificationToHTML(edg_wll_Context ctx, notifInfo *ni, char **message);
 char *edg_wll_ErrorToHTML(edg_wll_Context,int);
+int edg_wll_FileTransferStatusToHTML(edg_wll_Context ctx, edg_wll_JobStat stat, char **message);
 
 #endif /* GLITE_LB_HTML_H */
index 6d8d691..8b488e1 100644 (file)
@@ -27,6 +27,7 @@ limitations under the License.
 #include <stdlib.h>
 #include <time.h>
 #include <assert.h>
+#include <ctype.h>
 
 #ifdef __GNUC__
 #define UNUSED_VAR __attribute__((unused))
@@ -36,7 +37,7 @@ limitations under the License.
 
 #define TR(type, field) \
        if (field){ \
-               int l = asprintf(&pomA, type, (field)); \ 
+               int l = asprintf(&pomA, type, (field)); \
                pomB = realloc(pomB, sizeof(*pomB)*(pomL+l+1)); \
                strcpy(pomB+pomL, pomA); \
                pomL += l; \
@@ -49,7 +50,7 @@ limitations under the License.
                pomB = realloc(pomB, sizeof(*pomB)*(pomL+l+1)); \
                strcpy(pomB+pomL, pomA); \
                 pomL += l; \
-                free(pomA); pomA = NULL; \ 
+                free(pomA); pomA = NULL; \
        }
 
 
index fc253f4..40f8f28 100644 (file)
@@ -52,8 +52,6 @@ limitations under the License.
 
 static int store_user(edg_wll_Context,const char *,const char *); 
 static int store_job(edg_wll_Context,glite_jobid_const_t,const char *, int, int, int, int);
-/* FIXME: 'set_job_grey' defined but not used */
-static int set_job_grey(edg_wll_Context ctx, char *jobid);
 static int store_flesh(edg_wll_Context,edg_wll_Event *,const char *ulm, char *,int);
 /* FIXME: 'check_dup' defined but not used */
 static int check_dup(edg_wll_Context,edg_wll_Event *);
@@ -264,19 +262,6 @@ err:
 }
 
 
-static int set_job_grey(edg_wll_Context ctx, char *jobid)
-{
-       char *stmt;
-
-       trio_asprintf(&stmt,"update jobs set grey='1' where jobid='%|Ss'", jobid);
-       glite_common_log(LOG_CATEGORY_LB_SERVER_DB, LOG_PRIORITY_DEBUG, stmt);
-
-       edg_wll_ExecSQL(ctx,stmt,NULL); 
-
-       free(stmt);
-       return edg_wll_Error(ctx,NULL,NULL);
-}
-
 /* test whether job shares LB proxy and server DB or not */
 int is_job_local(edg_wll_Context ctx, glite_jobid_const_t jobId) 
 {