X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fsysdep.c;h=bf77408ee4e80fbe305594be210ff93bc49f03cd;hb=bb4db7b4e2620965dd7a57984d8f7d07ca4b4806;hp=164cafd5a70e2e530d888cb2b4df3695d5fb057e;hpb=ed4640564bf29690308619d12a11e7ad47d30bde;p=citadel.git diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 164cafd5a..bf77408ee 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -460,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