diff options
Diffstat (limited to 'usr/src/man')
-rw-r--r-- | usr/src/man/man1/ps.1 | 33 | ||||
-rw-r--r-- | usr/src/man/man1m/prstat.1m | 9 | ||||
-rw-r--r-- | usr/src/man/man3c/Makefile | 12 | ||||
-rw-r--r-- | usr/src/man/man3c/pthread_attr_getname_np.3c | 105 | ||||
-rw-r--r-- | usr/src/man/man3c/pthread_getname_np.3c | 124 | ||||
-rw-r--r-- | usr/src/man/man3c/thr_getname.3c | 124 | ||||
-rw-r--r-- | usr/src/man/man3lib/libproc.3lib | 60 | ||||
-rw-r--r-- | usr/src/man/man3proc/Makefile | 15 | ||||
-rw-r--r-- | usr/src/man/man3proc/Plwp_getname.3proc | 94 | ||||
-rw-r--r-- | usr/src/man/man4/proc.4 | 20 |
10 files changed, 541 insertions, 55 deletions
diff --git a/usr/src/man/man1/ps.1 b/usr/src/man/man1/ps.1 index afdda2f8ef..9f2fb063ca 100644 --- a/usr/src/man/man1/ps.1 +++ b/usr/src/man/man1/ps.1 @@ -44,9 +44,9 @@ .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved .\" Copyright (c) 2013 Gary Mills -.\" Copyright (c) 2017, Joyent, Inc. +.\" Copyright (c) 2018, Joyent, Inc. .\" -.TH PS 1 "Jun 13, 2017" +.TH PS 1 "August 22, 2018" .SH NAME ps \- report process status .SH SYNOPSIS @@ -1052,6 +1052,16 @@ one line to be printed for each lwp in the process. .sp .ne 2 .na +\fB\fBlwpname\fR\fR +.ad +.RS 11n +The name of the lwp, if set. Requesting this formatting option causes +one line to be printed for each lwp in the process. +.RE + +.sp +.ne 2 +.na \fB\fBnlwp\fR\fR .ad .RS 11n @@ -1176,8 +1186,8 @@ The data model of the process, printed in the same manner as via .sp .LP -Only \fBcomm\fR and \fBargs\fR are allowed to contain blank characters; all -others, including the Solaris implementation variables, are not. +Only \fBcomm\fR, \fBlwpname\fR, and \fBargs\fR are allowed to contain blank +characters; all others, including the Solaris implementation variables, are not. .sp .LP The following table specifies the default header to be used in the POSIX locale @@ -1199,7 +1209,7 @@ group GROUP time TIME nice NI tty TT pcpu %CPU user USER pgid PGID vsz VSZ -pid PID +pid PID .TE .sp @@ -1224,12 +1234,13 @@ fname COMMAND rss RSS gid GID ruid RUID lgrp LGRP s S lwp LWP sid SID -nlwp NLWP stime STIME -opri PRI taskid TASKID -osz SZ uid UID -pmem %MEM wchan WCHAN -pri PRI zone ZONE -ctid CTID zoneid ZONEID +lwpname LWPNAME stime STIME +nlwp NLWP taskid TASKID +opri PRI uid UID +osz SZ wchan WCHAN +pmem %MEM zone ZONE +pri PRI zoneid ZONEID +ctid CTID .TE .SH EXAMPLES diff --git a/usr/src/man/man1m/prstat.1m b/usr/src/man/man1m/prstat.1m index 35cb6fbf24..8ca1ffa70b 100644 --- a/usr/src/man/man1m/prstat.1m +++ b/usr/src/man/man1m/prstat.1m @@ -1,11 +1,11 @@ '\" te .\" Copyright (c) 2013 Gary Mills .\" Copyright (c) 2006, 2009 Sun Microsystems, Inc. All Rights Reserved. -.\" Copyright (c) 2017, Joyent, Inc. All Rights Reserved. +.\" Copyright (c) 2018, Joyent, Inc. All Rights Reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH PRSTAT 1M "Oct 13, 2017" +.TH PRSTAT 1M "September 1, 2018" .SH NAME prstat \- report active process statistics .SH SYNOPSIS @@ -583,11 +583,12 @@ The name of the process (name of executed file). .sp .ne 2 .na -\fBLWPID\fR +\fBLWP\fR .ad .sp .6 .RS 4n -The \fBlwp\fR \fBID\fR of the \fBlwp\fR being reported. +The \fBlwp\fR \fBID\fR of the \fBlwp\fR being reported, as well as the LWP +name if any is set. .RE .sp diff --git a/usr/src/man/man3c/Makefile b/usr/src/man/man3c/Makefile index 98102cdfa1..540a58948e 100644 --- a/usr/src/man/man3c/Makefile +++ b/usr/src/man/man3c/Makefile @@ -310,6 +310,7 @@ MANFILES= __fbufsize.3c \ pthread_attr_getdetachstate.3c \ pthread_attr_getguardsize.3c \ pthread_attr_getinheritsched.3c \ + pthread_attr_getname_np.3c \ pthread_attr_getschedparam.3c \ pthread_attr_getschedpolicy.3c \ pthread_attr_getscope.3c \ @@ -335,6 +336,7 @@ MANFILES= __fbufsize.3c \ pthread_equal.3c \ pthread_exit.3c \ pthread_getconcurrency.3c \ + pthread_getname_np.3c \ pthread_getschedparam.3c \ pthread_getspecific.3c \ pthread_join.3c \ @@ -478,6 +480,7 @@ MANFILES= __fbufsize.3c \ termios.3c \ thr_create.3c \ thr_exit.3c \ + thr_getname.3c \ thr_getconcurrency.3c \ thr_getprio.3c \ thr_join.3c \ @@ -1095,6 +1098,7 @@ MANLINKS= FD_CLR.3c \ pthread_attr_setdetachstate.3c \ pthread_attr_setguardsize.3c \ pthread_attr_setinheritsched.3c \ + pthread_attr_setname_np.3c \ pthread_attr_setschedparam.3c \ pthread_attr_setschedpolicy.3c \ pthread_attr_setscope.3c \ @@ -1131,6 +1135,7 @@ MANLINKS= FD_CLR.3c \ pthread_rwlockattr_destroy.3c \ pthread_rwlockattr_setpshared.3c \ pthread_setconcurrency.3c \ + pthread_setname_np.3c \ pthread_setschedparam.3c \ pthread_setspecific.3c \ pthread_spin_init.3c \ @@ -1294,6 +1299,7 @@ MANLINKS= FD_CLR.3c \ thr_continue.3c \ thr_getspecific.3c \ thr_keycreate_once.3c \ + thr_setname.3c \ thr_setconcurrency.3c \ thr_setprio.3c \ thr_setspecific.3c \ @@ -2143,6 +2149,8 @@ pthread_attr_setguardsize.3c := LINKSRC = pthread_attr_getguardsize.3c pthread_attr_setinheritsched.3c := LINKSRC = pthread_attr_getinheritsched.3c +pthread_attr_setname_np.3c := LINKSRC = pthread_attr_getname_np.3c + pthread_attr_setschedparam.3c := LINKSRC = pthread_attr_getschedparam.3c pthread_attr_setschedpolicy.3c := LINKSRC = pthread_attr_getschedpolicy.3c @@ -2177,6 +2185,8 @@ pthread_condattr_destroy.3c := LINKSRC = pthread_condattr_init.3c pthread_setconcurrency.3c := LINKSRC = pthread_getconcurrency.3c +pthread_setname_np.3c := LINKSRC = pthread_getname_np.3c + pthread_setschedparam.3c := LINKSRC = pthread_getschedparam.3c pthread_setspecific.3c := LINKSRC = pthread_getspecific.3c @@ -2411,6 +2421,8 @@ thr_setspecific.3c := LINKSRC = thr_keycreate.3c thr_continue.3c := LINKSRC = thr_suspend.3c +thr_setname.3c := LINKSRC = thr_getname.3c + timegm.3c := LINKSRC = mktime.3c timer_getoverrun.3c := LINKSRC = timer_settime.3c diff --git a/usr/src/man/man3c/pthread_attr_getname_np.3c b/usr/src/man/man3c/pthread_attr_getname_np.3c new file mode 100644 index 0000000000..fbac370410 --- /dev/null +++ b/usr/src/man/man3c/pthread_attr_getname_np.3c @@ -0,0 +1,105 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2018 Joyent, Inc. +.\" +.Dd "August 22, 2018" +.Dt PTHREAD_ATTR_GETNAME_NP 3C +.Os +.Sh NAME +.Nm pthread_attr_getname_np , +.Nm pthread_attr_setname_np +.Nd get or set thread name attribute +.Sh SYNOPSIS +.In pthread.h +. +.Ft int +.Fo pthread_attr_getname_np +.Fa "pthread_attr_t *restrict attr" +.Fa "char *name" +.Fa "size_t len" +.Fc +. +.Ft int +.Fo pthread_attr_setname_np +.Fa "pthread_attr_t *restrict attr" +.Fa "const char *name" +.Fc +. +.Sh DESCRIPTION +The +.Fn pthread_attr_setname_np +and +.Fn pthread_attr_getname_np +functions, respectively, set and get the thread name attribute in +.Fa attr +to +.Fa name . +For +.Fn pthread_attr_getname_np , +.Fa len +is the size of +.Fa name . +Any threads created with +.Xr pthread_create 3c +using +.Fa attr +will have their name set to +.Fa name +upon creation. +.Pp +Thread names are limited to +.Dv PTHREAD_MAX_NAMELEN_NP +including the terminating NUL. +They may only contain printable ASCII characters. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pthread_attr_getname_np +and +.Fn pthread_attr_setname_np +functions return +.Sy 0 . +Otherwise, an error number is returned to indicate the error. +.Sh ERRORS +The +.Fn pthread_attr_getname_np +function may fail with: +.Bl -tag -width Er +.It Er EINVAL +The +.Fa name +argument is +.Sy NULL . +.It Er ERANGE +The size of +.Fa name +as indicated by +.Fa len +is too small to contain the thread name. +The buffer may be over-written with partial contents of the thread name. +.El +.Pp +The +.Fn pthread_attr_setname_np +function may fail with: +.Bl -tag -width Er +.It Er ERANGE +The length of name given in +.Fa name +exceeds the maximum size allowed. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr pthread_create 3c , +.Xr pthread_getname_np 3c diff --git a/usr/src/man/man3c/pthread_getname_np.3c b/usr/src/man/man3c/pthread_getname_np.3c new file mode 100644 index 0000000000..7404a4abfe --- /dev/null +++ b/usr/src/man/man3c/pthread_getname_np.3c @@ -0,0 +1,124 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2018 Joyent, Inc. +.\" +.Dd "August 22, 2018" +.Dt PTHREAD_GETNAME_NP 3C +.Os +.Sh NAME +.Nm pthread_getname_np , +.Nm pthread_setname_np +.Nd get or set the name of a thread +.Sh SYNOPSIS +.In pthread.h +. +.Ft int +.Fo pthread_getname_np +.Fa "pthread_t tid" +.Fa "char *name" +.Fa "size_t len" +.Fc +. +.Ft int +.Fo pthread_setname_np +.Fa "pthread_t tid" +.Fa "const char *name" +.Fc +. +.Sh DESCRIPTION +The +.Fn pthread_getname_np +and +.Fn pthread_setname_np +functions, respectively, get and set the names of the thread whose id is given +by the +.Fa tid +parameter. +For +.Fn pthread_getname_np , +.Fa len +indicates the size of +.Fa name . +.Pp +Thread names are limited to +.Dv PTHREAD_MAX_NAMELEN_NP +including the terminating NUL. +They may only contain printable ASCII characters. +.Pp +To clear a thread name, call +.Fn pthread_setname_np +with +.Sy NULL . +.Pp +Unlike some other systems, threads do not inherit the process name by default. +.Sh RETURN VALUES +Upon successful completion, the +.Fn pthread_getname_np +and +.Fn pthread_setname_np +functions return +.Sy 0 . +Otherwise, an error number is returned to indicate the error. +If the thread identified by +.Fa tid +does not have a name set, +.Fa pthread_getname_np +will be set to an empty string (length = 0). +.Sh ERRORS +On failure, the contents of the buffer are undefined. +Errors from +.Xr open 2 , +.Xr read 2 , +or +.Xr write 2 +are possible. +In addition, the +.Fn pthread_getname_np +function will fail with: +.Bl -tag -width Er +.It Er EINVAL +The +.Fa name +argument is +.Sy NULL . +.It Er ERANGE +The size of +.Fa name +as given by +.Fa len +was not large enough to contain the name of the thread. +.It Er ESRCH +The thread +.Fa tid +was not found. +.El +.Pp +The +.Fn pthread_setname_np +function will fail with: +.Bl -tag -width Er +.It Er ERANGE +The length of +.Fa name +exceeds the maximum allowed size. +.It Er ESRCH +The thread +.Fa tid +was not found. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr pthread_attr_getname_np 3c , +.Xr pthread_create 3c diff --git a/usr/src/man/man3c/thr_getname.3c b/usr/src/man/man3c/thr_getname.3c new file mode 100644 index 0000000000..551e620d46 --- /dev/null +++ b/usr/src/man/man3c/thr_getname.3c @@ -0,0 +1,124 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2018 Joyent, Inc. +.\" +.Dd "August 22, 2018" +.Dt THR_GETNAME 3C +.Os +.Sh NAME +.Nm thr_getname , +.Nm thr_setname +.Nd get or set the name of a thread +.Sh SYNOPSIS +.In thread.h +. +.Ft int +.Fo thr_getname +.Fa "thread_t tid" +.Fa "char *name" +.Fa "size_t len" +.Fc +. +.Ft int +.Fo thr_setname +.Fa "thread_t tid" +.Fa "const char *name" +.Fc +. +.Sh DESCRIPTION +The +.Fn thr_getname +and +.Fn thr_setname +functions, respectively, get and set the names of the thread whose id is given +by the +.Fa tid +parameter. +For +.Fn thr_getname , +.Fa len +indicates the size of +.Fa name . +.Pp +Thread names are limited to +.Dv THREAD_NAME_MAX +including the terminating NUL. +They may only contain printable ASCII characters. +.Pp +To clear a thread name, call +.Fn thr_setname +with +.Sy NULL . +.Pp +Unlike some other systems, threads do not inherit the process name by default. +.Sh RETURN VALUES +Upon successful completion, the +.Fn thr_getname +and +.Fn thr_setname +functions return +.Sy 0 . +Otherwise, an error number is returned to indicate the error. +If the thread identified by +.Fa tid +does not have a name set, +.Fa thr_getname +will be set to an empty string (length = 0). +.Sh ERRORS +On failure, the contents of the buffer are undefined. +Errors from +.Xr open 2 , +.Xr read 2 , +or +.Xr write 2 +are possible. +In addition, the +.Fn thr_getname +function will fail with: +.Bl -tag -width Er +.It Er EINVAL +The +.Fa name +argument is +.Sy NULL . +.It Er ERANGE +The size of +.Fa name +as given by +.Fa len +was not large enough to contain the name of the thread. +.It Er ESRCH +The thread +.Fa tid +was not found. +.El +.Pp +The +.Fn thr_setname +function will fail with: +.Bl -tag -width Er +.It Er ERANGE +The length of +.Fa name +exceeds the maximum allowed size. +.It Er ESRCH +The thread +.Fa tid +was not found. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +.Sy MT-Safe +.Sh SEE ALSO +.Xr pthread_setname_np 3c , +.Xr thr_create 3c diff --git a/usr/src/man/man3lib/libproc.3lib b/usr/src/man/man3lib/libproc.3lib index 915febee0b..6b1e26eaf8 100644 --- a/usr/src/man/man3lib/libproc.3lib +++ b/usr/src/man/man3lib/libproc.3lib @@ -9,9 +9,9 @@ .\" http://www.illumos.org/license/CDDL. .\" .\" -.\" Copyright 2015 Joyent, Inc. +.\" Copyright 2018 Joyent, Inc. .\" -.Dd June 06, 2016 +.Dd August 31, 2018 .Dt LIBPROC 3LIB .Os .Sh NAME @@ -217,34 +217,34 @@ manipulation of the process itself. .It Sy Plmid_to_loadobj Ta Sy Plmid_to_map .It Sy Plookup_by_addr Ta Sy Plookup_by_name .It Sy Plwp_alt_stack Ta Sy Plwp_getfpregs -.It Sy Plwp_getpsinfo Ta Sy Plwp_getregs -.It Sy Plwp_getspymaster Ta Sy Plwp_main_stack -.It Sy Plwp_setfpregs Ta Sy Plwp_setregs -.It Sy Plwp_stack Ta Sy Pname_to_ctf -.It Sy Pname_to_loadobj Ta Sy Pname_to_map -.It Sy Pobjname Ta Sy Pobjname_resolved -.It Sy Pplatform Ta Sy Ppltdest -.It Sy Ppriv Ta Sy Ppsinfo -.It Sy Pputareg Ta Sy Prd_agent -.It Sy Pread Ta Sy Pread_string -.It Sy Preset_maps Ta Sy Psetbkpt -.It Sy Psecflags Ta Sy Psetcred -.It Sy Psetfault Ta Sy Psetflags -.It Sy Psetpriv Ta Sy Psetrun -.It Sy Psetsignal Ta Sy Psetsysentry -.It Sy Psetsysexit Ta Sy Psetwapt -.It Sy Psetzoneid Ta Sy Psignal -.It Sy Pstate Ta Sy Pstatus -.It Sy Pstop Ta Sy Pstopstatus -.It Sy Psync Ta Sy Psysentry -.It Sy Psysexit Ta Sy Puname -.It Sy Punsetflags Ta Sy Pupdate_maps -.It Sy Pupdate_syms Ta Sy Pwait -.It Sy Pwrite Ta Sy Pxecbkpt -.It Sy Pxecwapt Ta Sy Pxlookup_by_addr -.It Sy Pxlookup_by_addr_resolved Ta Sy Pxlookup_by_name -.It Sy Pzonename Ta Sy Pzonepath -.It Sy Pzoneroot Ta +.It Sy Plwp_getname Ta Sy Plwp_getpsinfo +.It Sy Plwp_getregs Ta Sy Plwp_getspymaster +.It Sy Plwp_main_stack Ta Sy Plwp_setfpregs +.It Sy Plwp_setregs Ta Sy Plwp_stack +.It Sy Pname_to_ctf Ta Sy Pname_to_loadobj +.It Sy Pname_to_map Ta Sy Pobjname +.It Sy Pobjname_resolved Ta Sy Pplatform +.It Sy Ppltdest Ta Sy Ppriv +.It Sy Ppsinfo Ta Sy Pputareg +.It Sy Prd_agent Ta Sy Pread +.It Sy Pread_string Ta Sy Preset_maps +.It Sy Psetbkpt Ta Sy Psecflags +.It Sy Psetcred Ta Sy Psetfault +.It Sy Psetflags Ta Sy Psetpriv +.It Sy Psetrun Ta Sy Psetsignal +.It Sy Psetsysentry Ta Sy Psetsysexit +.It Sy Psetwapt Ta Sy Psetzoneid +.It Sy Psignal Ta Sy Pstate +.It Sy Pstatus Ta Sy Pstop +.It Sy Pstopstatus Ta Sy Psync +.It Sy Psysentry Ta Sy Psysexit +.It Sy Puname Ta Sy Punsetflags +.It Sy Pupdate_maps Ta Sy Pupdate_syms +.It Sy Pwait Ta Sy Pwrite +.It Sy Pxecbkpt Ta Sy Pxecwapt +.It Sy Pxlookup_by_addr Ta Sy Pxlookup_by_addr_resolved +.It Sy Pxlookup_by_name Ta Sy Pzonename +.It Sy Pzonepath Ta Sy Pzoneroot Ta .El .Ss Thread interrogation and manipulation The following routines obtain information about a thread and allow diff --git a/usr/src/man/man3proc/Makefile b/usr/src/man/man3proc/Makefile index 0984b6871f..e59e81fbf3 100644 --- a/usr/src/man/man3proc/Makefile +++ b/usr/src/man/man3proc/Makefile @@ -12,12 +12,12 @@ # # Copyright 2011, Richard Lowe # Copyright 2013 Nexenta Systems, Inc. All rights reserved. -# Copyright 2015 Joyent, Inc. +# Copyright 2018 Joyent, Inc. # include $(SRC)/Makefile.master -MANSECT= 3proc +MANSECT= 3proc MANFILES= \ Lctlfd.3proc \ @@ -64,6 +64,7 @@ MANFILES= \ Plookup_by_addr.3proc \ Plwp_getasrs.3proc \ Plwp_getgwindows.3proc \ + Plwp_getname.3proc \ Plwp_getpsinfo.3proc \ Plwp_getregs.3proc \ Plwp_getspymaster.3proc \ @@ -160,10 +161,10 @@ MANFILES= \ Pwrite.3proc \ Pxecbkpt.3proc \ Pzonename.3proc \ - ps_lgetregs.3proc \ - ps_pglobal_lookup.3proc \ - ps_pread.3proc \ - ps_pstop.3proc + ps_lgetregs.3proc \ + ps_pglobal_lookup.3proc \ + ps_pread.3proc \ + ps_pstop.3proc MANLINKS= \ @@ -265,7 +266,7 @@ MANLINKS= \ Pxlookup_by_name.3proc \ Pxsymbol_iter.3proc \ Pzonepath.3proc \ - Pzoneroot.3proc + Pzoneroot.3proc ps_lgetfpregs.3proc := LINKSRC = ps_lgetregs.3proc diff --git a/usr/src/man/man3proc/Plwp_getname.3proc b/usr/src/man/man3proc/Plwp_getname.3proc new file mode 100644 index 0000000000..57326f9333 --- /dev/null +++ b/usr/src/man/man3proc/Plwp_getname.3proc @@ -0,0 +1,94 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2018 Joyent, Inc. +.\" +.Dd August 31, 2018 +.Dt PLWP_GETNAME 3PROC +.Os +.Sh NAME +.Nm Plwp_getname +.Nd get thread name +.Sh SYNOPSIS +.Lb libproc +.In libproc.h +.Ft int +.Fo Plwp_getname +.Fa "struct ps_prochandle *P" +.Fa "lwpid_t lwpid" +.Fa "char *buf" +.Fa "size_t bufsize" +.Fc +.Sh DESCRIPTION +The +.Fn Plwp_getname +function returns the thread name in the supplied buffer, from the +thread +.Fa lwpid +in the process handle +.Fa P . +.Pp +If no thread name is set, the buffer is set to the empty string. +The buffer should be at least +.Dv THREAD_NAME_MAX +in size. +.Pp +The +.Fn Plwp_getname +function only works on process handles that refer to active processes +and core files, it does not work on process handles that refer to +individual files. +.Sh RETURN VALUES +Upon successful completion, the +.Fn Plwp_getname +function returns 0. +Otherwise, +.Sy -1 +is returned, +.Sy errno +is set to indicate the error. +The buffer may be modified even if an error is returned. +.Sh ERRORS +For a full list of possible errors also see the +.Sy DIAGNOSTICS +section in +.Xr proc 4 . +.Pp +The +.Fn Plwp_getname +function will fail if: +.Bl -tag -width Er +.It Er ENODATA +.Fa P +refers to a file handle obtained through +.Xr Pgrab_file 3PROC . +.It Er EINVAL +The process handle +.Fa P +refers to a core file and the specified thread does not exist. +.It Er ENOENT +The process handle +.Fa P +refers to an active process and the specified thread does not exist. +.Fa P +.It Er ENAMETOOLONG +The buffer is not sufficient to hold the thread name. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted +.Sh MT-LEVEL +See +.Sy LOCKING +in +.Xr libproc 3LIB . +.Sh SEE ALSO +.Xr libproc 3LIB , +.Xr proc 4 diff --git a/usr/src/man/man4/proc.4 b/usr/src/man/man4/proc.4 index 3e5a9bb95f..b60c0085c7 100644 --- a/usr/src/man/man4/proc.4 +++ b/usr/src/man/man4/proc.4 @@ -1,11 +1,11 @@ '\" te .\" Copyright 1989 AT&T .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. -.\" Copyright 2017, Joyent, Inc. +.\" Copyright 2018, Joyent, Inc. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.Dd Jun 24, 2016 +.Dd "August 22, 2018" .Dt PROC 4 .Os .Sh NAME @@ -982,12 +982,12 @@ typedef struct psinfo { uintptr_t pr_argv; /* address of initial argument vector */ uintptr_t pr_envp; /* address of initial environment vector */ char pr_dmodel; /* data model of the process */ - lwpsinfo_t pr_lwp; /* information for representative lwp */ taskid_t pr_taskid; /* task id */ projid_t pr_projid; /* project id */ poolid_t pr_poolid; /* pool id */ zoneid_t pr_zoneid; /* zone id */ ctid_t pr_contract; /* process contract id */ + lwpsinfo_t pr_lwp; /* information for representative lwp */ } psinfo_t; .Ed .Pp @@ -1647,6 +1647,20 @@ The messages written to this file affect the specific lwp rather than the representative lwp, as is the case for the process's .Pa ctl file. +.Ss lwpname +A buffer of +.Dv THREAD_NAME_MAX +bytes representing the LWP name; the buffer is +zero-filled if the thread name is shorter than the buffer. +If no thread name is set, the buffer contains the empty string. +A read with a buffer shorter than +.Dv THREAD_NAME_MAX +bytes is not guaranteed +to be NUL-terminated. +Writing to this file will set the LWP name for the specific lwp. +This file may not be present in older operating system versions. +.Dv THREAD_NAME_MAX +may increase in the future; clients should be prepared for this. .Ss lwpstatus lwp-specific state information. This file contains the |