Instead of failing with ENAMETOOLONG, which is swallowed by
pthread_set_name_np() anyway, truncate the given name to MAXCOMLEN+1
bytes. This is more likely what the user wants, and saves the
caller from truncating it before the call (which was the only
recourse).
Polish pthread_set_name_np(3) and add a .Xr to thr_set_name(2)
so the user might find the documentation for this behavior.
Reviewed by: jilles
MFC after: 3 days
Sponsored by: Dell EMC
As Garrett points out,
It is no more a debugging interface than setproctitle(3), and has not
been since the name started getting stuffed into the kernel. This
statement may have made sense when the name was only visible in thread
state dumps and the debugger.
PR: threads/158815
Submitted by: wollman@