# HG changeset patch # User Roman Kennke # Date 1343117343 -7200 # Node ID a9efa2633708f8a6bbdbb39054f0a92011911371 Initial Linnux implementation for set_native_thread_name(). diff -r 000000000000 -r a9efa2633708 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Tue Jul 24 10:09:03 2012 +0200 @@ -0,0 +1,5 @@ +^\.hg +^\.mq +syntax: glob +status +guards diff -r 000000000000 -r a9efa2633708 linux_thread_name.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linux_thread_name.patch Tue Jul 24 10:09:03 2012 +0200 @@ -0,0 +1,25 @@ +# HG changeset patch +# Parent dd785aabe02bf33c7a0aac1913d39f4960e7763b + +diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp +--- a/src/os/linux/vm/os_linux.cpp ++++ b/src/os/linux/vm/os_linux.cpp +@@ -4344,9 +4344,16 @@ + return online_cpus; + } + ++#define MAXTHREADNAMESIZE 16 ++ + void os::set_native_thread_name(const char *name) { +- // Not yet implemented. +- return; ++ if (name != NULL) { ++ // The maximum length is 16 (including the trailing \0), we copy ++ // the first 15 chars into the buffer. ++ char buf[MAXTHREADNAMESIZE]; ++ snprintf(buf, sizeof(buf), "%s", name); ++ pthread_setname_np(pthread_self(), buf); ++ } + } + + bool os::distribute_processes(uint length, uint* distribution) { diff -r 000000000000 -r a9efa2633708 series --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/series Tue Jul 24 10:09:03 2012 +0200 @@ -0,0 +1,1 @@ +linux_thread_name.patch