Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 15 Sep 2016 07:57:03 -0400
From: Felix Janda <felix.janda@...teo.de>
To: musl@...ts.openwall.com
Subject: Re: [PATCH RFC] add pthread_setname_np

Alexander Monakov wrote:
> Hi,
> 
> On Wed, 14 Sep 2016, Felix Janda wrote:
> > --- /dev/null
> > +++ b/src/thread/pthread_setname_np.c
> > @@ -0,0 +1,21 @@
> [...]
> > +	snprintf(f, sizeof f, "/proc/self/task/%d/comm", thread->tid);
> > +	if ((fd = open(f, O_WRONLY)) < 0) return errno;
> > +	if (write(fd, name, len) < 0) status = errno;
> 
> 
> Is there a reason to do it this way rather than via prctl(PR_SET_NAME, ...)?
> If so, it should be mentioned in the commit message. (I think using prctl
> would be more appropriate)

pthread_setname_np() is more general than prctl(PR_SET_NAME, ...): It can
change the name of any thread, not just the calling one.

Felix

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.