*/
#define CITADEL PACKAGE_STRING
-#define REV_LEVEL 925 // This version
+#define REV_LEVEL 927 // This version
#define REV_MIN 591 // Oldest compatible database
#define EXPORT_REV_MIN 760 // Oldest compatible export files
#define LIBCITADEL_MIN 922 // Minimum required version of libcitadel
/* wrapper for txn_abort() that logs/aborts on error */
-static void txabort(DB_TXN * tid)
+static void txabort(DB_TXN *tid)
{
int ret;
/* wrapper for txn_commit() that logs/aborts on error */
-static void txcommit(DB_TXN * tid)
+static void txcommit(DB_TXN *tid)
{
int ret;
/* wrapper for txn_begin() that logs/aborts on error */
-static void txbegin(DB_TXN ** tid)
+static void txbegin(DB_TXN **tid)
{
int ret;
{
DBT dkey, ddata;
- DB_TXN *tid;
+ DB_TXN *tid = NULL;
int ret = 0;
-
struct CtdlCompressHeader zheader;
char *compressed_data = NULL;
int compressing = 0;
retry:
txbegin(&tid);
- if ((ret = dbp[cdb]->put(dbp[cdb], /* db */
- tid, /* transaction ID */
- &dkey, /* key */
- &ddata, /* data */
- 0))) { /* flags */
+ if ((ret = dbp[cdb]->put(dbp[cdb], // db
+ tid, // transaction ID
+ &dkey, // key
+ &ddata, // data
+ 0))) { // flags
if (ret == DB_LOCK_DEADLOCK) {
txabort(tid);
goto retry;
} else {
syslog(LOG_EMERG, "db: cdb_truncate(%d): %s", cdb, db_strerror(ret));
if (ret == ENOMEM) {
- syslog(LOG_EMERG,
- "db: You may need to tune your database; please read http://www.citadel.org/doku.php?id=faq:troubleshooting:out_of_lock_entries for more information.");
+ syslog(LOG_EMERG, "db: You may need to tune your database; please read http://www.citadel.org/doku.php?id=faq:troubleshooting:out_of_lock_entries for more information.");
}
exit(CTDLEXIT_DB);
}
+citadel (927-1) stable; urgency=low
+
+ * new release
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 19 Dec 2018 16:57:49 -0500
+
citadel (925-1) stable; urgency=low
* new release
uid_t ctdluid = 0;
const char *CitadelServiceUDS="citadel-UDS";
const char *CitadelServiceTCP="citadel-TCP";
-void go_threading(void);
int sanity_diag_mode = 0;
* Create or remove a lock file, so we only have one Citadel Server running at a time.
*/
void ctdl_lockfile(int yo) {
- static char lockfilename[SIZ];
+ static char lockfilename[PATH_MAX];
static FILE *fp;
if (yo) {
#endif
ctdl_lockfile(1);
-
- /* Initialize... */
- init_sysdep();
-
- /*
- * Do non system dependent startup functions.
- */
- master_startup();
-
- /*
- * Check that the control record is correct and place sensible values if it isn't
- */
- check_control();
-
- /*
- * Run any upgrade entry points
- */
- syslog(LOG_INFO, "main: upgrading modules");
+ init_sysdep(); // Initialize...
+ master_startup(); // Do non system dependent startup functions
+ check_control(); // Check, sanitize, initialize the control record
+ syslog(LOG_INFO, "main: upgrading modules"); // Run any upgrade entry points
upgrade_modules();
-
+
/*
* Load the user for the masterCC or create them if they don't exist
*/
do_async_loop,
CitadelServiceTCP);
-
-
-
/*
* Load any server-side extensions available here.
*/
init_ssl();
#endif
- /*
- * Set up a place to put thread-specific data.
- * We only need a single pointer per thread - it points to the
- * CitContext structure (in the ContextList linked list) of the
- * session to which the calling thread is currently bound.
- */
- if (pthread_key_create(&MyConKey, NULL) != 0) {
+ if (pthread_key_create(&ThreadKey, NULL) != 0) { // TSD for threads
+ syslog(LOG_ERR, "pthread_key_create() : %m");
+ abort();
+ }
+
+ if (pthread_key_create(&MyConKey, NULL) != 0) { // TSD for sessions
syslog(LOG_CRIT, "sysdep: can't create TSD key: %m");
+ abort();
}
/*
/*
* Thread handling stuff for Citadel server
*
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2019 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 3.
#include "context.h"
#include "threads.h"
-
int num_workers = 0; /* Current number of worker threads */
int active_workers = 0; /* Number of ACTIVE worker threads */
pthread_key_t ThreadKey;
pthread_mutex_t Critters[MAX_SEMAPHORES]; /* Things needing locking */
struct thread_tsd masterTSD;
int server_shutting_down = 0; /* set to nonzero during shutdown */
-
-pthread_mutex_t ThreadCountMutex;;
-
+pthread_mutex_t ThreadCountMutex;
void InitializeSemaphores(void)
{
}
-
-
/*
* Obtain a semaphore lock to begin a critical section.
* but only if no one else has one
pthread_mutex_lock(&Critters[which_one]);
}
+
/*
* Release a semaphore lock to end a critical section.
*/
}
-
-
/*
* Return a pointer to our thread-specific (not session-specific) data.
*/
struct thread_tsd *MyThread(void) {
- register struct thread_tsd *c;
- return ((c = (struct thread_tsd *) pthread_getspecific(ThreadKey), c == NULL) ? &masterTSD : c);
+ struct thread_tsd *c = (struct thread_tsd *) pthread_getspecific(ThreadKey) ;
+ if (!c) {
+ return &masterTSD;
+ }
+ return c;
}
-
/*
* Called by CtdlThreadCreate()
* We have to pass through here before starting our thread in order to create a set of data
pthread_setspecific(ThreadKey, (const void *) mytsd);
start_routine(NULL);
-
-// free(mytsd);
+ // free(mytsd);
return(NULL);
}
pthread_attr_t attr;
int ret = 0;
-
ret = pthread_attr_init(&attr);
ret = pthread_attr_setstacksize(&attr, THREADSTACKSIZE);
ret = pthread_create(&thread, &attr, CTC_backend, (void *)start_routine);
void InitializeMasterTSD(void) {
+ TRACE;
memset(&masterTSD, 0, sizeof(struct thread_tsd));
}
*/
void go_threading(void)
{
- if (pthread_key_create(&ThreadKey, NULL) != 0) {
- syslog(LOG_ERR, "pthread_key_create() : %m");
- abort();
- }
-
pthread_mutex_init(&ThreadCountMutex, NULL);
/* Second call to module init functions now that threading is up */
DBC *cursors[MAXCDB]; /* Cursors, for traversals... */
};
+pthread_key_t ThreadKey;
extern struct thread_tsd masterTSD;
#define TSD MyThread()
// Phase 2 : perform the callback for each username
for (i=0; i<num_users; ++i) {
- syslog(LOG_DEBUG, "user_ops: %3d %3d %s", i, usernames[i].version, usernames[i].username); // FIXME
- if (usernames[i].version < 927) {
- // FIXME we have to reindex this record
- }
+ //if (usernames[i].version < 927) {
+ // FIXME This is where we will do the reindexing stuff
+ //}
(*CallBack) (usernames[i].username, in_data);
}