Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160915143350.GG15995@brightrain.aerifal.cx>
Date: Thu, 15 Sep 2016 10:33:50 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH RFC] add pthread_setname_np

On Thu, Sep 15, 2016 at 07:57:03AM -0400, Felix Janda wrote:
> 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.

It might be nice to use prctl if thread==pthread_self(), just to avoid
dependency on /proc in this case. But I think that's a minor detail.
This is a non-critical feature anyway.

Rich

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.