This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Support for pthread_setname_np / pthread_getname_np
- From: Bert Wesarg <bert dot wesarg at googlemail dot com>
- To: John Stultz <johnstul at us dot ibm dot com>
- Cc: libc-help at sourceware dot org
- Date: Fri, 19 Mar 2010 08:14:39 +0100
- Subject: Re: [PATCH] Support for pthread_setname_np / pthread_getname_np
- References: <1268959744-1197-1-git-send-email-johnstul@us.ibm.com>
On Fri, Mar 19, 2010 at 01:49, John Stultz <johnstul@us.ibm.com> wrote:
> I've recently committed support to the Linux kernel for accessing and
> setting a threads comm value via the proc interface. This should allow
> for pthread_setname_np() / pthread_getname_np() functionality to be
> implemented in glibc.
>
> See the kernel git commit here:
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=4614a696bd1c3a9af3a08f0e5874830a85b889d4
>
> I'm very unfamiliar with glibc and its coding conventions wanted to send
> out a very raw first pass of how such functionality could be (poorly)
> implemented.
>
> Any feedback, suggestions or total rewrites by more skilled coders would
> be welcome!
>
> thanks
> -john
> diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
> index b84fd5c..b82057c 100644
> --- a/nptl/sysdeps/pthread/pthread.h
> +++ b/nptl/sysdeps/pthread/pthread.h
> @@ -1095,6 +1095,12 @@ extern int pthread_setspecific (pthread_key_t __key,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â__const void *__pointer) __THROW ;
>
>
> +extern int pthread_setname_np (pthread_t __th, char *__name)
> + Â Â __THROW __nonnull ((2));
> +
> +extern int pthread_getname_np (pthread_t __th, char *__name)
> + Â Â __THROW __nonnull ((2));
Why does have the get routine not a size parameter for the name buffer?
Bert
> +
> Â#ifdef __USE_XOPEN2K
> Â/* Get ID of CPU-time clock for thread THREAD_ID. Â*/
> Âextern int pthread_getcpuclockid (pthread_t __thread_id,
> --
> 1.6.0.4
>
>