'\" te .\" Copyright (c) 2001, The IEEE and The Open Group. All Rights Reserved. .\" Portions Copyright (c) 2005, 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_attr_setname_np 3C "12 Feb 2015" "SunOS 5.11" "Standard C Library Functions" .SH NAME pthread_attr_setname_np, pthread_attr_getname_np \- set and get the thread name .SH SYNOPSIS .LP .nf #include .fi .LP .nf \fBint\fR \fIpthread_attr_setname_np\fR(\fBpthread_attr_t\fR \fI*attr\fR, \fBconst char\fR \fI*name\fR); .fi .LP .nf \fBint\fR \fIpthread_attr_getname_np\fR(\fBpthread_attr_t\fR \fI*attr\fR, \fBchar\fR \fI*buf\fR, \fBsize_t\fR \fIlen\fR); .fi .SH DESCRIPTION .sp .LP The \fBpthread_attr_setname_np()\fR and \fBpthread_attr_getname_np()\fR functions are used to set and get the \fBthreadname\fR attribute in the \fBattr\fR object. The default value for this attribute is NULL. The maximum length of the \fBthreadname\fR attribute is 31 bytes, UTF-8 encoded. .sp .LP For \fBpthread_attr_setname_np()\fR, if the length of the name is greater than 31, the excess bytes are silently ignored. For \fBpthread_attr_getname_np()\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 Upon successful completion, these functions return a 0; otherwise, an error number is returned to indicate the error. .SH ERRORS .sp .LP The \fBpthread_attr_setname_np()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt \fBattr\fR is NULL. .RE .sp .LP The \fBpthread_attr_getname_np()\fR function may fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt \fBattr\fR or \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_setname_np\fR(3C), \fBthreads\fR(5), \fBattributes\fR(5)