32-bit cleaniness -- we are far beyond second 2^31/1000 now
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 9 Apr 2009 15:22:09 +0000 (15:22 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 9 Apr 2009 15:22:09 +0000 (15:22 +0000)
org.glite.lb.logger/src/event_store.c
org.glite.lb.logger/src/interlogd.h

index 5aa9919..1b519ef 100644 (file)
@@ -94,11 +94,12 @@ jobid2controlfile(IL_EVENT_ID_T job_id)
 }
 
 static
-int
+long long
 fname2index(const char *filename)
 {
        char *p = rindex(filename, '.');
        char *s;
+       long long       ret;
 
        if(p == NULL)
                return 0;
@@ -109,7 +110,8 @@ fname2index(const char *filename)
                }
        }
 
-       return atoi(p+1)+1;
+       sscanf(p+1,"%lld",&ret);
+       return ret+1;
 }
 
 
@@ -211,7 +213,7 @@ event_store_create(char *job_id_s, const char *filename)
   es->rotate_index = filename ? fname2index(filename) : 0;
   IL_EVENT_ID_FREE(job_id);
 
-  il_log(LOG_DEBUG, "  creating event store for id %s, filename %s, rotate index %d\n",
+  il_log(LOG_DEBUG, "  creating event store for id %s, filename %s, rotate index %lld\n",
         job_id_s, es->event_file_name, es->rotate_index);
 
   if(pthread_rwlock_init(&es->commit_lock, NULL))
index e5ff035..b2fdde4 100644 (file)
@@ -125,7 +125,7 @@ struct event_store {
        long      offset;                  /* expected file position of next event */
        time_t    last_modified;           /* time of the last file modification */
        int       generation;              /* cleanup counter, scopes the offset */
-       int               rotate_index;                    /* rotation counter */
+       long long                 rotate_index;                    /* rotation counter */
        struct  event_store_list *le;      /* points back to the list */
        pthread_rwlock_t commit_lock;      /* lock to prevent simultaneous updates to last_committed_* */
        pthread_rwlock_t offset_lock;      /* lock to prevent simultaneous updates offset */