summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2017-06-14 19:57:04 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2017-06-14 19:57:04 +0000
commit2d5a4c1c2f160534cd59ec9bd0504219263116e3 (patch)
tree9c41cd0da2976bed73bfcac5176728ea79f55b06
parent57b03984a1f527616cfb62664228f873a3d84bef (diff)
downloadgcompat-2d5a4c1c2f160534cd59ec9bd0504219263116e3.tar.gz
gcompat-2d5a4c1c2f160534cd59ec9bd0504219263116e3.tar.bz2
gcompat-2d5a4c1c2f160534cd59ec9bd0504219263116e3.tar.xz
gcompat-2d5a4c1c2f160534cd59ec9bd0504219263116e3.zip
recent musl has pthread_setname_np().
-rw-r--r--Makefile1
-rw-r--r--libgcompat/pthread.c31
2 files changed, 0 insertions, 32 deletions
diff --git a/Makefile b/Makefile
index b6e497a..5d18d84 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,6 @@ LIBGCOMPAT_SRC = \
libgcompat/gnulib.c \
libgcompat/malloc.c \
libgcompat/math.c \
- libgcompat/pthread.c \
libgcompat/resource.c \
libgcompat/setjmp.c \
libgcompat/stdio.c \
diff --git a/libgcompat/pthread.c b/libgcompat/pthread.c
deleted file mode 100644
index b4ea054..0000000
--- a/libgcompat/pthread.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-/* "Now we are all sons of bitches." */
-int pthread_setname_np(pthread_t thread, const char *name)
-{
- char path[PATH_MAX];
- int fd;
- /* Cthulhu have mercy */
- pid_t *my_pid = (pid_t *)((void *)thread + (sizeof(uintptr_t) * 7));
- size_t len = strlen(name);
-
- if(len > 15)
- {
- return -ERANGE;
- }
-
- snprintf(path, PATH_MAX, "/proc/self/tid/%u/name", *my_pid);
- fd = open(path, O_RDWR);
- write(fd, name, len + 1);
- close(fd);
-
- return 0;
-}