'\" te .\" Copyright (c) 2001, the Institute of Electrical and Electronics Engineers, Inc. and The Open Group. All Rights Reserved. .\" Portions Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. .\" Oracle gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. This notice shall appear on any product containing this material. .TH pthread_setname_np 3C "12 Feb 2015" "SunOS 5.11" "Standard C Library Functions" .SH NAME pthread_setname_np, pthread_getname_np \- set and get the thread name .SH SYNOPSIS .LP .nf #include \fBint\fR \fBpthread_setname_np\fR(\fBpthread_t\fR \fIt\fR, \fBconst char\fR \fI*name\fR ); \fBint\fR \fBpthread_getname_np\fR(\fBpthread_t\fR \fIt\fR, \fBchar\fR \fI*buf\fR, \fBsize_t\fR \fIlen\fR); .fi .SH DESCRIPTION .sp .LP The \fBpthread_setname_np()\fR function associates a name with a thread \fBt\fR. The thread name is a string of length 31 bytes or less, UTF-8 encoded. If the length of name is greater than 31, the excess bytes are silently ignored. .sp .LP The \fBpthread_getname_np()\fR function returns the name of the specified thread \fBt\fR in \fBbuf\fR. At most, \fBlen-1\fR non-null characters are copied into \fBbuf\fR. The returned thread name will be null-terminated. .SH RETURN VALUES .sp .LP If successful, the \fBpthread_setname_np()\fR and \fBpthread_getname_np()\fR functions return 0. Otherwise, an error number is returned to indicate the error. It is not an error for the target thread to be a zombie thread. .SH ERRORS .sp .LP The \fBpthread_setname_np()\fR and \fBpthread_getname_np()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBESRCH\fR\fR .ad .RS 9n .rt The value specified by thread does not refer to an existing thread. .RE .sp .LP The \fBpthread_getname_np()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt \fBbuf\fR is NULL. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe .TE .SH SEE ALSO .sp .LP \fBpthread_attr_init\fR(3C), \fBpthread_attr_setname_np\fR(3C), \fBthreads\fR(5), \fBattributes\fR(5), \fBstandards\fR(5)