* use SYS_gettid to retrieve our LWPID when running in linux; this way we can find out whats loading top
* don't use masterCC's logbuffer
dnl TODO: for the DB header checks, we should check whether the headers
dnl define db_env_create, somehow
dnl
dnl TODO: for the DB header checks, we should check whether the headers
dnl define db_env_create, somehow
dnl
-AC_CHECK_HEADERS(curses.h dl.h fcntl.h limits.h malloc.h termios.h sys/ioctl.h sys/select.h sys/stat.h sys/time.h sys/prctl.h syslog.h unistd.h utmp.h utmpx.h paths.h db.h db4/db.h pthread.h netinet/in.h arpa/nameser.h arpa/nameser_compat.h)
+AC_CHECK_HEADERS(curses.h dl.h fcntl.h limits.h malloc.h termios.h sys/ioctl.h sys/select.h sys/stat.h sys/time.h sys/prctl.h syslog.h unistd.h utmp.h utmpx.h paths.h db.h db4/db.h pthread.h netinet/in.h arpa/nameser.h arpa/nameser_compat.h syscall.h sys/syscall.h)
dnl
dnl need to check if this is actually compilable, sometimes there are
dnl
dnl need to check if this is actually compilable, sometimes there are
recp = (struct recptypes *) malloc(sizeof(struct recptypes));
if (recp == NULL) return;
memset(recp, 0, sizeof(struct recptypes));
recp = (struct recptypes *) malloc(sizeof(struct recptypes));
if (recp == NULL) return;
memset(recp, 0, sizeof(struct recptypes));
+ memset(&ut, 0, sizeof(struct UseTable));
recp->recp_room = strdup(ri->roomlist);
recp->num_room = num_tokens(ri->roomlist, '|');
recp->recptypes_magic = RECPTYPES_MAGIC;
recp->recp_room = strdup(ri->roomlist);
recp->num_room = num_tokens(ri->roomlist, '|');
recp->recptypes_magic = RECPTYPES_MAGIC;
CtdlFillSystemContext(&rssclientCC, "rssclient");
citthread_setspecific(MyConKey, (void *)&rssclientCC );
CtdlFillSystemContext(&rssclientCC, "rssclient");
citthread_setspecific(MyConKey, (void *)&rssclientCC );
- CtdlThreadAllocTSD();
-
/*
* This is a simple concurrency check to make sure only one rssclient run
* is done at a time. We could do this with a mutex, but since we
/*
* This is a simple concurrency check to make sure only one rssclient run
* is done at a time. We could do this with a mutex, but since we
struct CitContext smtp_queue_CC;
CtdlFillSystemContext(&smtp_queue_CC, "SMTP Send");
struct CitContext smtp_queue_CC;
CtdlFillSystemContext(&smtp_queue_CC, "SMTP Send");
- CtdlLogPrintf(CTDL_INFO, "SMTP client: processing outbound queue\n");
-
citthread_setspecific(MyConKey, (void *)&smtp_queue_CC );
citthread_setspecific(MyConKey, (void *)&smtp_queue_CC );
+ CtdlLogPrintf(CTDL_INFO, "SMTP client: processing outbound queue\n");
if (CtdlGetRoom(&CC->room, SMTP_SPOOLOUT_ROOM) != 0) {
CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
if (CtdlGetRoom(&CC->room, SMTP_SPOOLOUT_ROOM) != 0) {
CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
node = cTSD->self;
if ((node != NULL) && (node->reltid != 0))
{
node = cTSD->self;
if ((node != NULL) && (node->reltid != 0))
{
- lwpid = node->pid + node->reltid;
}
gettimeofday(&tv, NULL);
}
gettimeofday(&tv, NULL);
unixtime = tv.tv_sec;
localtime_r(&unixtime, &tim);
unixtime = tv.tv_sec;
localtime_r(&unixtime, &tim);
+ if ((CCC != NULL) && (CCC != &masterCC))
lBuf = CCC->lBuf;
else
lBuf = NewStrBuf();
lBuf = CCC->lBuf;
else
lBuf = NewStrBuf();
}
vsnprintf(buf2, SIZ, format, arg_ptr);
}
vsnprintf(buf2, SIZ, format, arg_ptr);
- fprintf(stderr, "%s%s", buf, buf2);
+ fprintf(stderr, ":%s%s", buf, buf2);
}
else {
StrBufPrintf(lBuf,
}
else {
StrBufPrintf(lBuf,
int m;
int i;
int retval;
int m;
int i;
int retval;
+ struct CitContext select_on_master_CC;
+
+ CtdlFillSystemContext(&select_on_master_CC, "select_on_master");
+ citthread_setspecific(MyConKey, (void *)&select_on_master_CC);
while (!CtdlThreadCheckStop()) {
/* Initialize the fdset. */
while (!CtdlThreadCheckStop()) {
/* Initialize the fdset. */
+ CtdlClearSystemContext();
+
# include <time.h>
# endif
#endif
# include <time.h>
# endif
#endif
+#ifdef HAVE_SYSCALL_H
+#include <syscall.h>
+#else if HAVE_SYS_SYSCALL_H
+#include <sys/syscall.h>
+#endif
#include <libcitadel.h>
#include "threads.h"
#include <libcitadel.h>
#include "threads.h"
* remove the need for the calls to eCrashRegisterThread and friends
*/
* remove the need for the calls to eCrashRegisterThread and friends
*/
-static int next_tid = 3; /* offset LWPID to PID */
static int num_threads = 0; /* Current number of threads */
static int num_workers = 0; /* Current number of worker threads */
long statcount = 0; /* are we doing a stats check? */
static int num_threads = 0; /* Current number of threads */
static int num_workers = 0; /* Current number of worker threads */
long statcount = 0; /* are we doing a stats check? */
#endif
// Tell the world we are here
#endif
// Tell the world we are here
+#ifdef HAVE_SYSCALL_H
+ this_thread->reltid = syscall(SYS_gettid);
+#endif
CtdlLogPrintf(CTDL_NOTICE, "Created a new thread \"%s\" (0x%08lx).\n",
this_thread->name, this_thread->tid);
CtdlLogPrintf(CTDL_NOTICE, "Created a new thread \"%s\" (0x%08lx).\n",
this_thread->name, this_thread->tid);
free(this_thread);
return NULL;
}
free(this_thread);
return NULL;
}
- this_thread->reltid = next_tid;
- next_tid++;
num_threads++; // Increase the count of threads in the system.
if(this_thread->flags & CTDLTHREAD_WORKER)
num_workers++;
num_threads++; // Increase the count of threads in the system.
if(this_thread->flags & CTDLTHREAD_WORKER)
num_workers++;