Page MenuHomeFreeBSD

Add pthread_get_name_np(3).
ClosedPublic

Authored by kib on Aug 13 2018, 3:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 5:41 PM
Unknown Object (File)
Fri, Dec 20, 5:37 PM
Unknown Object (File)
Tue, Dec 17, 5:21 AM
Unknown Object (File)
Fri, Dec 13, 3:51 PM
Unknown Object (File)
Fri, Dec 6, 3:45 PM
Unknown Object (File)
Tue, Dec 3, 10:42 PM
Unknown Object (File)
Mon, Nov 25, 6:06 PM
Unknown Object (File)
Sun, Nov 24, 11:45 AM

Details

Summary

The function retrieves the thread name previously set by pthread_set_name_np(3). The name is cached in the process memory.

Requested by: Willem Jan Withagen <wjw@digiware.nl>
Man page update: Yuri Pankov <yuripv@yuripv.net>

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Just a couple of grammar nits on the manpage.

share/man/man3/pthread_set_name_np.3
52 ↗(On Diff #46621)

"function"

72 ↗(On Diff #46621)

No "functions" here.

kib marked 2 inline comments as done.

Grammar fixes.

ian added inline comments.
lib/libthr/thread/thr_info.c
91 ↗(On Diff #46624)

What about when thread->name is NULL? Doesn't this need handling, like...

else if (len > 0)
  buf[0] = 0;
pluknet added inline comments.
share/man/man3/pthread_set_name_np.3
72 ↗(On Diff #46624)

Please note that this duplicates what's already (perhaps, vaguely) documented in pthread(3)'s STANDARDS section:

The functions with the pthread_ prefix and _np suffix are non-portable
extensions to POSIX threads.
kib marked an inline comment as done.Aug 13 2018, 4:19 PM
kib added inline comments.
share/man/man3/pthread_set_name_np.3
72 ↗(On Diff #46624)

Yes, but what do you want me to change there ? I do not see a harm in repeating this information.

Handle nameless threads.

This revision is now accepted and ready to land.Aug 13 2018, 4:28 PM
share/man/man3/pthread_set_name_np.3
72 ↗(On Diff #46624)

Just a FYI, I see no problem here.

arichardson added inline comments.
lib/libthr/thread/thr_info.c
57 ↗(On Diff #46629)

Could this be thread->name = strdup(name) instead? It will also set the value to null on allocation failure.

kib marked an inline comment as done.

Use strdup(3).

I was so concerned with another use of malloc(3) in libthr, so when I decided that it is fine, failed to realize that I reimplemented strdup(3).

This revision now requires review to proceed.Aug 14 2018, 1:56 PM
This revision was not accepted when it landed; it landed in state Needs Review.Aug 17 2018, 6:24 PM
Closed by commit rS337981: Reorder alphabetically. (authored by kib). · Explain Why
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state Needs Review.Aug 17 2018, 6:34 PM
Closed by commit rS337983: Add pthread_get_name_np(3). (authored by kib). · Explain Why
This revision was automatically updated to reflect the committed changes.