From d3d07d41b3634ea357db9602e6a5915996d5f61d Mon Sep 17 00:00:00 2001 From: deuce <> Date: Wed, 28 Jan 2009 01:16:02 +0000 Subject: [PATCH] Clean up thread names... remove the word "thread" from them. Also, on FreeBSD, SetThreadName() will silently fail if the name is more than 19 bytes long (not including terminating null) truncate as needed. --- src/sbbs3/ftpsrvr.c | 6 +++--- src/sbbs3/js_global.c | 2 +- src/sbbs3/mailsrvr.c | 6 +++--- src/sbbs3/main.cpp | 14 +++++++------- src/sbbs3/sbbscon.c | 4 ++-- src/sbbs3/services.c | 10 +++++----- src/sbbs3/websrvr.c | 6 +++--- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/sbbs3/ftpsrvr.c b/src/sbbs3/ftpsrvr.c index a628798212..8426da4bed 100644 --- a/src/sbbs3/ftpsrvr.c +++ b/src/sbbs3/ftpsrvr.c @@ -1346,7 +1346,7 @@ static void send_thread(void* arg) xfer=*(xfer_t*)arg; free(arg); - SetThreadName("FTP Send thread"); + SetThreadName("FTP Send"); thread_up(TRUE /* setuid */); length=flength(xfer.filename); @@ -1605,7 +1605,7 @@ static void receive_thread(void* arg) xfer=*(xfer_t*)arg; free(arg); - SetThreadName("FTP RECV Thread"); + SetThreadName("FTP RECV"); thread_up(TRUE /* setuid */); if((fp=fopen(xfer.filename,xfer.append ? "ab" : "wb"))==NULL) { @@ -2398,7 +2398,7 @@ static void ctrl_thread(void* arg) JSString* js_str; #endif - SetThreadName("FTP CTRL thread"); + SetThreadName("FTP CTRL"); thread_up(TRUE /* setuid */); lastactive=time(NULL); diff --git a/src/sbbs3/js_global.c b/src/sbbs3/js_global.c index 0863e1ad4c..3801b70f15 100644 --- a/src/sbbs3/js_global.c +++ b/src/sbbs3/js_global.c @@ -117,7 +117,7 @@ static void background_thread(void* arg) jsval result=JSVAL_VOID; jsval exit_code; - SetThreadName("JS Background Thread"); + SetThreadName("JS Background"); msgQueueAttach(bg->msg_queue); JS_SetContextThread(bg->cx); JS_BEGINREQUEST(bg->cx); diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c index 4cea252395..32eaa140bf 100644 --- a/src/sbbs3/mailsrvr.c +++ b/src/sbbs3/mailsrvr.c @@ -696,7 +696,7 @@ static void pop3_thread(void* arg) mail_t* mail; pop3_t pop3=*(pop3_t*)arg; - SetThreadName("POP3 Thread"); + SetThreadName("POP3"); thread_up(TRUE /* setuid */); free(arg); @@ -2130,7 +2130,7 @@ static void smtp_thread(void* arg) } cmd = SMTP_CMD_NONE; - SetThreadName("SMTP Thread"); + SetThreadName("SMTP"); thread_up(TRUE /* setuid */); free(arg); @@ -3824,7 +3824,7 @@ static void sendmail_thread(void* arg) size_t len; BOOL sending_locally=FALSE; - SetThreadName("SendMail Thread"); + SetThreadName("SendMail"); thread_up(TRUE /* setuid */); sendmail_running=TRUE; diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index 5fdbf1a68f..7a979eef7b 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -1414,7 +1414,7 @@ void input_thread(void *arg) SOCKET high_socket; SOCKET sock; - SetThreadName("Node Input Thread"); + SetThreadName("Node Input"); thread_up(TRUE /* setuid */); #ifdef _DEBUG @@ -1688,7 +1688,7 @@ void passthru_output_thread(void* arg) int rd; int wr; - SetThreadName("Passthrough Output Thread"); + SetThreadName("Passthrough Output"); thread_up(FALSE /* setuid */); sbbs->passthru_output_thread_running = true; @@ -1800,7 +1800,7 @@ void passthru_input_thread(void* arg) BYTE ch; int i; - SetThreadName("Passthrough Input Thread"); + SetThreadName("Passthrough Input"); thread_up(FALSE /* setuid */); sbbs->passthru_input_thread_running = true; @@ -1893,7 +1893,7 @@ void output_thread(void* arg) struct timeval tv; ulong mss=IO_THREAD_BUF_SIZE; - SetThreadName("Node Output Thread"); + SetThreadName("Node Output"); thread_up(TRUE /* setuid */); if(sbbs->cfg.node_num) @@ -2107,7 +2107,7 @@ void event_thread(void* arg) sbbs_srand(); /* Seed random number generator */ - SetThreadName("BBS Events Thread"); + SetThreadName("BBS Events"); thread_up(TRUE /* setuid */); #ifdef JAVASCRIPT @@ -3802,7 +3802,7 @@ void node_thread(void* arg) sbbs_t* sbbs = (sbbs_t*) arg; update_clients(); - SetThreadName("Node Thread"); + SetThreadName("Node"); thread_up(TRUE /* setuid */); #ifdef _DEBUG @@ -4305,7 +4305,7 @@ void DLLCALL bbs_thread(void* arg) startup->shutdown_now=FALSE; terminate_server=false; - SetThreadName("BBS Thread"); + SetThreadName("BBS"); do { diff --git a/src/sbbs3/sbbscon.c b/src/sbbs3/sbbscon.c index d1aac1dfdb..aef910af5a 100644 --- a/src/sbbs3/sbbscon.c +++ b/src/sbbs3/sbbscon.c @@ -1090,7 +1090,7 @@ static void handle_sigs(void) int sig=0; sigset_t sigs; - SetThreadName("Signal Handler Thread"); + SetThreadName("Signal Handler"); thread_up(NULL,TRUE,TRUE); if (is_daemon) { @@ -1198,7 +1198,7 @@ int main(int argc, char** argv) printf("\nSynchronet Console for %s Version %s%c %s\n\n" ,PLATFORM_DESC,VERSION,REVISION,COPYRIGHT_NOTICE); - SetThreadName("Main Thread"); + SetThreadName("Main"); atexit(cleanup); ctrl_dir=getenv("SBBSCTRL"); /* read from environment variable */ diff --git a/src/sbbs3/services.c b/src/sbbs3/services.c index b5a1690c7d..14fccce1c3 100644 --- a/src/sbbs3/services.c +++ b/src/sbbs3/services.c @@ -1051,7 +1051,7 @@ static void js_service_thread(void* arg) lprintf(LOG_DEBUG,"%04d %s JavaScript service thread started", socket, service->protocol); - SetThreadName("JS Service Thread"); + SetThreadName("JS Service"); thread_up(TRUE /* setuid */); /* Host name lookup and filtering */ @@ -1218,7 +1218,7 @@ static void js_static_service_thread(void* arg) lprintf(LOG_DEBUG,"%04d %s static JavaScript service thread started", service->socket, service->protocol); - SetThreadName("JS Static Service Thread"); + SetThreadName("JS Static Service"); thread_up(TRUE /* setuid */); memset(&service_client,0,sizeof(service_client)); @@ -1311,7 +1311,7 @@ static void native_static_service_thread(void* arg) lprintf(LOG_DEBUG,"%04d %s static service thread started", socket, service->protocol); - SetThreadName("Native Static Service Thread"); + SetThreadName("Static Service"); thread_up(TRUE /* setuid */); #ifdef _WIN32 @@ -1375,7 +1375,7 @@ static void native_service_thread(void* arg) lprintf(LOG_DEBUG,"%04d %s service thread started", socket, service->protocol); - SetThreadName("Native Service Thread"); + SetThreadName("Native Service"); thread_up(TRUE /* setuid */); /* Host name lookup and filtering */ @@ -1719,7 +1719,7 @@ void DLLCALL services_thread(void* arg) startup->recycle_now=FALSE; startup->shutdown_now=FALSE; - SetThreadName("Services Thread"); + SetThreadName("Services"); do { diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c index e2351582e1..176dd47286 100644 --- a/src/sbbs3/websrvr.c +++ b/src/sbbs3/websrvr.c @@ -4752,7 +4752,7 @@ void http_output_thread(void *arg) int i; unsigned mss=OUTBUF_LEN; - SetThreadName("HTTP Output Thread"); + SetThreadName("HTTP Output"); obuf=&(session->outbuf); /* Destroyed at end of function */ if((i=pthread_mutex_init(&session->outbuf_write,NULL))!=0) { @@ -4870,7 +4870,7 @@ void http_session_thread(void* arg) int loop_count; BOOL init_error; - SetThreadName("HTTP Session Thread"); + SetThreadName("HTTP Session"); pthread_mutex_lock(&((http_session_t*)arg)->struct_filled); pthread_mutex_unlock(&((http_session_t*)arg)->struct_filled); pthread_mutex_destroy(&((http_session_t*)arg)->struct_filled); @@ -5175,7 +5175,7 @@ void http_logging_thread(void* arg) if(!base[0]) SAFEPRINTF(base,"%slogs/http-",scfg.logs_dir); - SetThreadName("HTTP Logging Thread"); + SetThreadName("HTTP Logging"); filename[0]=0; newfilename[0]=0; -- GitLab