From ab618543cc6fc4bc273c077ef5d247961cdb29d4 Mon Sep 17 00:00:00 2001 From: John Levon Date: Mon, 8 Oct 2018 15:34:11 +0100 Subject: 8158 Want named threads API 9857 proc manpages should have LIBRARY section Reviewed by: Andy Fiddaman Reviewed by: Gordon Ross Approved by: Dan McDonald --- usr/src/head/pthread.h | 11 ++++++++++- usr/src/head/thread.h | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'usr/src/head') diff --git a/usr/src/head/pthread.h b/usr/src/head/pthread.h index 91d268a30d..490a93f1b2 100644 --- a/usr/src/head/pthread.h +++ b/usr/src/head/pthread.h @@ -21,7 +21,7 @@ /* * Copyright 2014 Garrett D'Amore - * Copyright 2016 Joyent, Inc. + * Copyright 2018 Joyent, Inc. * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -139,6 +139,9 @@ extern "C" { /* barriers */ #define PTHREAD_BARRIER_SERIAL_THREAD -2 +/* For pthread_{get,set}name_np(). */ +#define PTHREAD_MAX_NAMELEN_NP (32) + #ifndef _ASM /* @@ -209,6 +212,10 @@ extern int pthread_attr_setschedparam(pthread_attr_t *_RESTRICT_KYWD, const struct sched_param *_RESTRICT_KYWD); extern int pthread_attr_getschedparam(const pthread_attr_t *_RESTRICT_KYWD, struct sched_param *_RESTRICT_KYWD); +extern int pthread_attr_setname_np(pthread_attr_t *_RESTRICT_KYWD, + const char *_RESTRICT_KYWD); +extern int pthread_attr_getname_np(pthread_attr_t *_RESTRICT_KYWD, + char *_RESTRICT_KYWD, size_t); extern int pthread_create(pthread_t *_RESTRICT_KYWD, const pthread_attr_t *_RESTRICT_KYWD, void * (*)(void *), void *_RESTRICT_KYWD); @@ -231,6 +238,8 @@ extern int pthread_key_delete(pthread_key_t); extern int pthread_setspecific(pthread_key_t, const void *); extern void *pthread_getspecific(pthread_key_t); extern pthread_t pthread_self(void); +extern int pthread_setname_np(pthread_t, const char *); +extern int pthread_getname_np(pthread_t, char *, size_t); /* * function prototypes - synchronization related calls diff --git a/usr/src/head/thread.h b/usr/src/head/thread.h index d0b0b3ddeb..704174d411 100644 --- a/usr/src/head/thread.h +++ b/usr/src/head/thread.h @@ -24,6 +24,8 @@ * * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2018 Joyent, Inc. */ #ifndef _THREAD_H @@ -87,6 +89,8 @@ extern int thr_keycreate_once(thread_key_t *, void(*)(void *)); extern int thr_setspecific(thread_key_t, void *); extern int thr_getspecific(thread_key_t, void **); extern size_t thr_min_stack(void); +extern int thr_getname(thread_t, char *, size_t); +extern int thr_setname(thread_t, const char *); #endif /* _ASM */ -- cgit v1.2.3