]> code.citadel.org Git - citadel.git/blobdiff - citadel/sysdep.c
Created a routine to get a copy of the context list so that it can be
[citadel.git] / citadel / sysdep.c
index c55c0ca6906e760c6363adf7f6f8810ada6148cf..bf77408ee4e80fbe305594be210ff93bc49f03cd 100644 (file)
@@ -141,7 +141,6 @@ void vlprintf(enum LogLevel loglevel, const char *format, va_list arg_ptr)
                /* Promote to time_t; types differ on some OSes (like darwin) */
                unixtime = tv.tv_sec;
                localtime_r(&unixtime, &tim);
-/*
                if (CC->cs_pid != 0) {
                        sprintf(buf,
                                "%04d/%02d/%02d %2d:%02d:%02d.%06ld [%3d] ",
@@ -156,11 +155,6 @@ void vlprintf(enum LogLevel loglevel, const char *format, va_list arg_ptr)
                                tim.tm_mday, tim.tm_hour, tim.tm_min,
                                tim.tm_sec, (long)tv.tv_usec);
                }
-FIXME temp i want to see CC */
-                       sprintf(buf,
-                               "%2d:%02d:%02d.%06ld 0x%08lx ",
-                               tim.tm_hour, tim.tm_min,
-                               tim.tm_sec, (long)tv.tv_usec, CC);
                vsnprintf(buf2, SIZ, format, arg_ptr);   
 
                fprintf(stderr, "%s%s", buf, buf2);
@@ -466,6 +460,24 @@ struct CitContext *CreateNewContext(void) {
 }
 
 
+struct CitContext *CtdlGetContextArray(int *count)
+{
+       int nContexts, i;
+       struct CitContext *nptr, *cptr;
+       
+       nContexts = num_sessions;
+       nptr = malloc(sizeof(struct CitContext) * nContexts);
+       if (!nptr)
+               return NULL;
+       begin_critical_section(S_SESSION_TABLE);
+       for (cptr = ContextList, i=0; cptr != NULL && i < nContexts; cptr = cptr->next, i++)
+               memcpy(&nptr[i], cptr, sizeof (struct CitContext));
+       end_critical_section (S_SESSION_TABLE);
+       
+       *count = i;
+       return nptr;
+}
+
 /*
  * The following functions implement output buffering. If the kernel supplies
  * native TCP buffering (Linux & *BSD), use that; otherwise, emulate it with