diff options
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | eio.c | 16 | ||||
-rw-r--r-- | libeio.m4 | 12 |
3 files changed, 24 insertions, 5 deletions
@@ -58,4 +58,5 @@ TODO: fadvise request - do not acquire any locks when forking. - incorporated some mingw32 changes by traviscline. - added syncfs support, using direct syscall. + - set thread name on linux (ps -L/Hcx, top, gdb). @@ -203,6 +203,14 @@ static void eio_destroy (eio_req *req); # include <utime.h> #endif +#if HAVE_SYS_SYSCALL_H +# include <sys/syscall.h> +#endif + +#if HAVE_SYS_PRCTL_H +# include <sys/prctl.h> +#endif + #if HAVE_SENDFILE # if __linux # include <sys/sendfile.h> @@ -218,10 +226,6 @@ static void eio_destroy (eio_req *req); # endif #endif -#if HAVE_SYS_SYSCALL_H -# include <sys/syscall.h> -#endif - #ifndef D_TYPE # define D_TYPE(de) 0 #endif @@ -1915,6 +1919,10 @@ X_THREAD_PROC (etp_proc) struct timespec ts; etp_worker *self = (etp_worker *)thr_arg; +#if HAVE_PRCTL_SET_NAME + prctl (PR_SET_NAME, (unsigned long)"eio_thread", 0, 0, 0); +#endif + /* try to distribute timeouts somewhat evenly */ ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); @@ -1,6 +1,6 @@ dnl openbsd in it's neverending brokenness requires stdint.h for intptr_t, dnl but that header isn't very portable... -AC_CHECK_HEADERS([stdint.h sys/syscall.h]) +AC_CHECK_HEADERS([stdint.h sys/syscall.h sys/prctl.h]) AC_SEARCH_LIBS( pthread_create, @@ -148,6 +148,16 @@ int main (void) ],ac_cv_sys_syncfs=yes,ac_cv_sys_syncfs=no)]) test $ac_cv_sys_syncfs = yes && AC_DEFINE(HAVE_SYS_SYNCFS, 1, syscall(__NR_syncfs) is available) +AC_CACHE_CHECK(for prctl_set_name, ac_cv_prctl_set_name, [AC_LINK_IFELSE([ +#include <sys/prctl.h> +int main (void) +{ + char name[] = "test123"; + int res = prctl (PR_SET_NAME, (unsigned long)name, 0, 0, 0); +} +],ac_cv_prctl_set_name=yes,ac_cv_prctl_set_name=no)]) +test $ac_cv_prctl_set_name = yes && AC_DEFINE(HAVE_PRCTL_SET_NAME, 1, prctl(PR_SET_NAME) is available) + dnl ############################################################################# dnl # these checks exist for the benefit of IO::AIO |