.\" Copyright (c) 2015 The DragonFly Project. All rights reserved. .\" .\" This code is derived from software contributed to The DragonFly Project .\" by Sepherosa Ziehau . .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in .\" the documentation and/or other materials provided with the .\" distribution. .\" 3. Neither the name of The DragonFly Project nor the names of its .\" contributors may be used to endorse or promote products derived .\" from this software without specific, prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .Dd November 19, 2015 .Dt LWP_SETNAME 2 .Os .Sh NAME .Nm lwp_setname .Nm lwp_getname .Nd Set or retrieve the lwp name that shows up in ps. .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In sys/lwp.h .Ft int .Fn lwp_setname "lwpid_t tid" "const char *name" .Ft int .Fn lwp_getname "lwpid_t tid" "char *name" "size_t len" .Sh DESCRIPTION The .Fn lwp_setname system call sets the lwp name. The lwp is in the process calling this system call, and the lwp is specified by .Fa tid . If the .Fa name is .Dv NULL , the lwp name will be set to the process name, which is the default name of the lwp. The .Fa name will be truncated, if it is longer than .Dv MAXCOMLEN . .Pp The .Fn lwp_getname system call gets the lwp name, storing it in the supplied buffer up to (len - 1) characters plus the terminator. The buffer will always be terminated. .Sh RETURN VALUES This system call returns \-1 on error and 0 upon successful completion. .Sh ERRORS The .Fn lwp_setname system call will fail if: .Bl -tag -width Er .It Bq Er EFAULT The .Fa name parameter is outside the process's allocated address space. .El .Sh SEE ALSO .Xr lwp_create 2 , .Xr setproctitle 3 .Sh HISTORY The .Fn lwp_setname function first appeared in .Dx 4.3 .