int writeFid = (intptr_t)param;
afs_int32 code = 0;
- afs_pthread_setname_self("Database Dumper");
+ opr_threadname_set("Database Dumper");
code = InitRPC(&dumpSyncPtr->ut, LOCKREAD, 1);
if (code)
goto error_exit;
{
afs_int32 code;
- afs_pthread_setname_self("Database Dump Watchdog");
+ opr_threadname_set("Database Dump Watchdog");
while (1) { /*w */
/* printf("dumpWatcher\n"); */
#include <roken.h>
+#include <afs/opr.h>
#include <rx/xdr.h>
#include <rx/rx.h>
#include <lwp.h>
afs_int32 code = 0;
int i, c, addedDump;
- afs_pthread_setname_self("dbWatcher");
+ opr_threadname_set("dbWatcher");
dlqInit(&entries_to_flush);
dlqInit(&savedEntries);
#include <roken.h>
+#include <afs/opr.h>
#include <rx/xdr.h>
#include <rx/rx.h>
#include <lwp.h>
extern struct deviceSyncNode *deviceLatch;
extern struct tapeConfig globalTapeConfig;
- afs_pthread_setname_self("dumper");
+ opr_threadname_set("dumper");
taskId = nodePtr->taskID; /* Get task Id */
setStatus(taskId, DRIVE_WAIT);
EnterDeviceQueue(deviceLatch);
dumpid = ptr->dumpID;
taskId = ptr->taskId; /* Get task Id */
- afs_pthread_setname_self("deletedump");
+ opr_threadname_set("deletedump");
setStatus(taskId, DRIVE_WAIT);
EnterDeviceQueue(deviceLatch);
clearStatus(taskId, DRIVE_WAIT);
time_t startTime, endTime;
afs_int32 goodrestore = 0;
- afs_pthread_setname_self("restorer");
+ opr_threadname_set("restorer");
taskId = newNode->taskID;
setStatus(taskId, DRIVE_WAIT);
EnterDeviceQueue(deviceLatch);
afs_uint32 taskId;
afs_int32 code = 0;
- afs_pthread_setname_self("labeller");
+ opr_threadname_set("labeller");
taskId = labelIfPtr->taskId;
setStatus(taskId, DRIVE_WAIT);
EnterDeviceQueue(deviceLatch);
#include <roken.h>
+#include <afs/opr.h>
#include <rx/xdr.h>
#include <rx/rx.h>
#include <lwp.h>
afs_uint32 taskId;
afs_int32 code = 0;
- afs_pthread_setname_self("scandump");
+ opr_threadname_set("scandump");
taskId = ptr->taskId;
setStatus(taskId, DRIVE_WAIT);
EnterDeviceQueue(deviceLatch);
extern struct deviceSyncNode *deviceLatch;
extern struct tapeConfig globalTapeConfig;
- afs_pthread_setname_self("Db save");
+ opr_threadname_set("Db save");
expires = (saveDbIfPtr->archiveTime ? NEVERDATE : 0);
taskId = saveDbIfPtr->taskId;
dumpEntry.id = 0;
extern struct tapeConfig globalTapeConfig;
extern struct deviceSyncNode *deviceLatch;
- afs_pthread_setname_self("Db restore");
+ opr_threadname_set("Db restore");
setStatus(taskId, DRIVE_WAIT);
EnterDeviceQueue(deviceLatch); /* lock tape device */
clearStatus(taskId, DRIVE_WAIT);
extern struct udbHandleS udbHandle;
- afs_pthread_setname_self("Keep-alive");
+ opr_threadname_set("Keep-alive");
while (1) {
#ifdef AFS_PTHREAD_ENV
sleep(5);
include @TOP_OBJDIR@/src/config/Makefile.pthread
include @TOP_OBJDIR@/src/config/Makefile.libtool
-LT_objs = assert.lo casestrcpy.lo dict.lo fmt.lo proc.lo rbtree.lo softsig.lo uuid.lo
+LT_objs = assert.lo casestrcpy.lo dict.lo fmt.lo proc.lo rbtree.lo \
+ softsig.lo threadname.lo uuid.lo
LT_libs = $(LIB_hcrypto) $(LIB_roken)
HEADERS = $(TOP_INCDIR)/afs/opr.h \
opr_stolower
opr_stoupper
opr_strcompose
+opr_threadname_set
opr_ucstring
opr_softsig_Init
opr_softsig_Register
extern void opr_stoupper(char *s) AFS_NONNULL((1));
extern char *opr_strcompose(char *buf, size_t len, ...) AFS_NONNULL((1));
+/* threadname.c */
+
+#ifdef AFS_PTHREAD_ENV
+extern void opr_threadname_set(const char *threadname);
+#else
+static_inline void
+opr_threadname_set(const char *threadname)
+{
+ /* noop */
+}
+#endif
+
#endif
#include <afsconfig.h>
#include <afs/param.h>
-#include "afsutil.h"
+#include <afs/opr.h>
#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
# include <pthread.h>
# endif
void
-afs_pthread_setname_self(const char *threadname)
+opr_threadname_set(const char *threadname)
{
# if defined(HAVE_PTHREAD_SET_NAME_NP)
- /* FreeBSD style */
- pthread_set_name_np(pthread_self(), threadname);
+ /* FreeBSD style */
+ pthread_set_name_np(pthread_self(), threadname);
# elif defined(HAVE_PTHREAD_SETNAME_NP)
# if PTHREAD_SETNAME_NP_ARGS == 3
- /* DECthreads style */
- pthread_setname_np(pthread_self(), threadname, (void *)0);
+ /* DECthreads style */
+ pthread_setname_np(pthread_self(), threadname, (void *)0);
# elif PTHREAD_SETNAME_NP_ARGS == 2
- /* GNU libc on Linux style */
- pthread_setname_np(pthread_self(), threadname);
+ /* GNU libc on Linux style */
+ pthread_setname_np(pthread_self(), threadname);
# elif PTHREAD_SETNAME_NP_ARGS == 1
- /* Mac OS style */
- pthread_setname_np(threadname);
+ /* Mac OS style */
+ pthread_setname_np(threadname);
# else
-# error "Could not identify your pthread_setname_np() implementation"
-# endif
-# endif
+# error "Could not identify your pthread_setname_np() implementation"
+# endif /* PTHREAD_SETNAME_NP_ARGS */
+# endif /* HAVE_PTHREAD_SETNAME_NP */
}
-#endif
+#endif /* AFS_PTHREAD_ENV && !AFS_NT40_ENV */
struct ubik_version tversion;
afs_int32 startTime;
- afs_pthread_setname_self("beacon");
+ opr_threadname_set("beacon");
/* loop forever getting votes */
lastWakeupTime = 0; /* keep track of time we last started a vote collection */
int fd = -1;
afs_int32 pass;
- afs_pthread_setname_self("recovery");
+ opr_threadname_set("recovery");
/* otherwise, begin interaction */
urecovery_state = 0;
hputil.lo kreltime.lo uuid.lo serverLog.lo \
dirpath.lo fileutil.lo flipbase64.lo fstab.lo \
afs_atomlist.lo afs_lhash.lo pthread_glock.lo tabular_output.lo \
- pthread_threadname.lo ${REGEX_OBJ}
+ ${REGEX_OBJ}
LT_deps = $(top_builddir)/src/opr/liboafs_opr.la
LT_libs = $(LIB_roken) $(MT_LIBS)
/* pthread_glock.c */
-/* pthread_threadname.c */
-#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
-extern void afs_pthread_setname_self(const char *threadname);
-#else
-/* Allow unconditional references to afs_pthread_setname_self to
- * reduce #ifdef spaghetti.
- */
-#define afs_pthread_setname_self(threadname) (void)0
-#endif
-
/* readdir_nt.c */
afs_htonuuid
afs_inet_ntoa_r
afs_ntohuuid
-afs_pthread_setname_self
afs_uuid_create
afs_uuid_equal
afs_uuid_hash
/* set our 'thread-id' so that the host hold table works */
threadId = rx_SetThreadNum();
- afs_pthread_setname_self(s);
+ opr_threadname_set(s);
ViceLog(0, ("Set thread id 0x%x for '%s'\n", threadId, s));
#endif
}
static void *
ShutdownWatchdogLWP(void *unused)
{
- afs_pthread_setname_self("ShutdownWatchdog");
+ opr_threadname_set("ShutdownWatchdog");
sleep(panic_timeout);
ViceLogThenPanic(0, ("ShutdownWatchdogLWP: Failed to shutdown and panic "
"within %d seconds; forcing panic\n",
/* set our 'thread-id' so that the host hold table works */
tid = rx_SetThreadNum();
Log("Set thread id %d for FSYNC_sync\n", tid);
- afs_pthread_setname_self("FSYNC_sync");
+ opr_threadname_set("FSYNC_sync");
#endif /* AFS_PTHREAD_ENV */
VOL_LOCK;
struct timeval tv;
int loop = 0;
- afs_pthread_setname_self("vol bkg");
+ opr_threadname_set("vol bkg");
while (1) {
tv.tv_sec = GCWAKEUP;
tv.tv_usec = 0;