lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



2012/11/26 Hisham <h@hisham.hm>
One alternative is to detect Linux with `#ifdef linux` (or Glibc <
2.12; there's probably an #ifdef for that) and use prctl(2) instead.
It works fine on threads:

   prctl(PR_SET_NAME, "myThread", 0, 0, 0);

This edits the name that shows up in /proc/$$/stat (I suppose that's
the thread name you want to edit? At least that's the one I use for
displaying thread names in htop).


I check for linux with

#ifdef __linux__

and I found that I can also check glibc version with


#define __GLIBC__       2
#define __GLIBC_MINOR__ 4

Anyway, prctl isn't what I want since I want to set the name of the thread, not the process. But fixing the build issue is good enough for now :-).

Regards,
 
--
Benoit.