v2:
autoload PerfDataHelper functions
Keep loadavg in shared memory
Guard loadavg access by a mutex
Initialize loadavg to the current load
v3:
Shared memory version bump isn't needed if we are only extending it
Remove unused autoload
Mark inititalized flags as NO_COPY for correct behaviour in fork child
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Note that this always returns with dli_sname and dli_saddr set to NULL,
indicating no symbol matching addr could be found.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
This patch adds pthread_getname_np and pthread_setname_np.
These were added to glibc in 2.12[1] and are also present in some form on
NetBSD and several UNIXes.
The code is based on NetBSD's implementation with changes to better match
Linux behaviour.
Implementation quirks:
* pthread_setname_np with a NULL pointer segfaults (as linux)
* pthread_setname_np returns ERANGE for names longer than 16 characters (as
linux)
* pthread_getname_np with a NULL pointer returns EFAULT (as linux)
* pthread_getname_np with a buffer length of less than 16 returns ERANGE (as
linux)
* pthread_getname_np truncates the thread name to fit the buffer length.
This guarantees success even when the default thread name is longer than 16
characters, but means there is no way to discover the actual length of the
thread name. (Linux always truncates the thread name to 16 characters)
* Changing program_invocation_short_name changes the default thread name (on
linux, it has no effect on the default thread name)
I'll leave it up to you to decide if any of these matter.
This is implemented via class pthread_attr to make it easier to add
pthread_attr_[gs]etname_np (present in NetBSD and some UNIXes) should it
ever be added to Linux (or we decide we want it anyway).
[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS
winsup/cygwin/
* common.din (__gnu_basename): Export.
* path.cc (__gnu_basename): New function.
winsup/doc/
* posix.xml (std-gnu): Add basename.
(std-notes): Add note about two forms of basename.
appropriate.
(DBXDIRS): Remove.
(XSLTPROC): Define for symmetry. Use throughout.
(clean): Drop removing cygwin-api.xml and doctool.*.
(cygwin-api.xml): Drop rule.
(doctool): Drop rule.
(Makefile.dep): Add dependency to cygwin-api.xml.
* cygwin-api.in.xml: Rename to cygwin-api.xml. Convert includes to
XML XInclude style.
* doctool.c: Remove.
* doctool.txt: Remove.
* faq-programming.xml: Drop reference to local utils.xml file.
* path.xml: Moved from ../cygwin and converted to XML.
* posix.xml: Ditto.
* using.xml: Drop relative path from utils.xml include.
* utils.xml: Moved from ../utils.