summaryrefslogtreecommitdiffstats
path: root/src/server/helper.c
diff options
context:
space:
mode:
authorSimon Rettberg2013-08-13 16:51:16 +0200
committerSimon Rettberg2013-08-13 16:51:16 +0200
commit4249a20d130262bc9b5e562fc73b712ce072b0b7 (patch)
tree30196f25d131d90ba25ed85db4decb8bd86a4c60 /src/server/helper.c
parentI'm stupid (diff)
downloaddnbd3-4249a20d130262bc9b5e562fc73b712ce072b0b7.tar.gz
dnbd3-4249a20d130262bc9b5e562fc73b712ce072b0b7.tar.xz
dnbd3-4249a20d130262bc9b5e562fc73b712ce072b0b7.zip
[SERVER] Fix race condition in uplink request aggregation, other small improvements and debugging features
Diffstat (limited to 'src/server/helper.c')
-rw-r--r--src/server/helper.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/server/helper.c b/src/server/helper.c
index 24ee0fb..bc723e3 100644
--- a/src/server/helper.c
+++ b/src/server/helper.c
@@ -5,6 +5,7 @@
#include <fcntl.h>
#include <assert.h>
#include <sys/stat.h>
+#include <sys/prctl.h> // For thread names
#include "../types.h"
#include "../config.h"
@@ -172,3 +173,9 @@ int file_alloc(int fd, uint64_t offset, uint64_t size)
if ( write( fd, "", 1 ) != 1 ) return FALSE;
return TRUE;
}
+
+void setThreadName(char *name)
+{
+ if ( strlen( name ) > 16 ) name[16] = '\0';
+ prctl( PR_SET_NAME, (unsigned long)name, 0, 0, 0 );
+}