Added thread names
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -89,6 +90,8 @@ send_response(struct MHD_Connection* conn, const char* body, int status_code)
|
||||
int connection_cb(void* cls, struct MHD_Connection* conn, const char* url, const char* method,
|
||||
const char* version, const char* data, size_t* size, void** con_cls)
|
||||
{
|
||||
prctl(PR_SET_NAME, "stbbrhttp");
|
||||
|
||||
if (*con_cls == NULL) {
|
||||
ConnectionInfo *con_info = create_connection_info();
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
@@ -126,7 +127,9 @@ log_println(const char * const msg, ...)
|
||||
GTimeZone *tz = g_time_zone_new_local();
|
||||
GDateTime *dt = g_date_time_new_now(tz);
|
||||
gchar *date_fmt = g_date_time_format(dt, "%d/%m/%Y %H:%M:%S");
|
||||
fprintf(logp, "%s: %s\n", date_fmt, fmt_msg->str);
|
||||
char thr_name[16];
|
||||
prctl(PR_GET_NAME, thr_name);
|
||||
fprintf(logp, "%s: [%s] %s\n", date_fmt, thr_name, fmt_msg->str);
|
||||
g_date_time_unref(dt);
|
||||
g_time_zone_unref(tz);
|
||||
fflush(logp);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
#include "server/xmppclient.h"
|
||||
#include "server/stream_parser.h"
|
||||
@@ -255,6 +256,8 @@ server_wait_for(char *id)
|
||||
void*
|
||||
_start_server_cb(void* userdata)
|
||||
{
|
||||
prctl(PR_SET_NAME, "stbbr");
|
||||
|
||||
struct sockaddr_in client_addr;
|
||||
|
||||
// listen socket non blocking
|
||||
|
||||
Reference in New Issue
Block a user