10ca59c34SSepherosa Ziehau.\" Copyright (c) 2015 The DragonFly Project. All rights reserved. 20ca59c34SSepherosa Ziehau.\" 30ca59c34SSepherosa Ziehau.\" This code is derived from software contributed to The DragonFly Project 40ca59c34SSepherosa Ziehau.\" by Sepherosa Ziehau <sepherosa@gmail.com>. 50ca59c34SSepherosa Ziehau.\" 60ca59c34SSepherosa Ziehau.\" Redistribution and use in source and binary forms, with or without 70ca59c34SSepherosa Ziehau.\" modification, are permitted provided that the following conditions 80ca59c34SSepherosa Ziehau.\" are met: 90ca59c34SSepherosa Ziehau.\" 100ca59c34SSepherosa Ziehau.\" 1. Redistributions of source code must retain the above copyright 110ca59c34SSepherosa Ziehau.\" notice, this list of conditions and the following disclaimer. 120ca59c34SSepherosa Ziehau.\" 2. Redistributions in binary form must reproduce the above copyright 130ca59c34SSepherosa Ziehau.\" notice, this list of conditions and the following disclaimer in 140ca59c34SSepherosa Ziehau.\" the documentation and/or other materials provided with the 150ca59c34SSepherosa Ziehau.\" distribution. 160ca59c34SSepherosa Ziehau.\" 3. Neither the name of The DragonFly Project nor the names of its 170ca59c34SSepherosa Ziehau.\" contributors may be used to endorse or promote products derived 180ca59c34SSepherosa Ziehau.\" from this software without specific, prior written permission. 190ca59c34SSepherosa Ziehau.\" 200ca59c34SSepherosa Ziehau.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 210ca59c34SSepherosa Ziehau.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 220ca59c34SSepherosa Ziehau.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 230ca59c34SSepherosa Ziehau.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 240ca59c34SSepherosa Ziehau.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 250ca59c34SSepherosa Ziehau.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 260ca59c34SSepherosa Ziehau.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 270ca59c34SSepherosa Ziehau.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 280ca59c34SSepherosa Ziehau.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 290ca59c34SSepherosa Ziehau.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 300ca59c34SSepherosa Ziehau.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 310ca59c34SSepherosa Ziehau.\" SUCH DAMAGE. 320ca59c34SSepherosa Ziehau.\" 330ca59c34SSepherosa Ziehau.Dd November 19, 2015 340ca59c34SSepherosa Ziehau.Dt LWP_SETNAME 2 350ca59c34SSepherosa Ziehau.Os 360ca59c34SSepherosa Ziehau.Sh NAME 37*3856b434SSascha Wildner.Nm lwp_setname , 38eb396e51SMatthew Dillon.Nm lwp_getname 39*3856b434SSascha Wildner.Nd set or retrieve the lwp name that shows up in ps 400ca59c34SSepherosa Ziehau.Sh LIBRARY 410ca59c34SSepherosa Ziehau.Lb libc 420ca59c34SSepherosa Ziehau.Sh SYNOPSIS 430d9899e7SSepherosa Ziehau.In sys/lwp.h 440ca59c34SSepherosa Ziehau.Ft int 450ca59c34SSepherosa Ziehau.Fn lwp_setname "lwpid_t tid" "const char *name" 46eb396e51SMatthew Dillon.Ft int 47eb396e51SMatthew Dillon.Fn lwp_getname "lwpid_t tid" "char *name" "size_t len" 480ca59c34SSepherosa Ziehau.Sh DESCRIPTION 490ca59c34SSepherosa ZiehauThe 500ca59c34SSepherosa Ziehau.Fn lwp_setname 510ca59c34SSepherosa Ziehausystem call sets the lwp name. 520ca59c34SSepherosa ZiehauThe lwp is in the process calling this system call, 530ca59c34SSepherosa Ziehauand the lwp is specified by 540ca59c34SSepherosa Ziehau.Fa tid . 550ca59c34SSepherosa ZiehauIf the 560ca59c34SSepherosa Ziehau.Fa name 570ca59c34SSepherosa Ziehauis 580ca59c34SSepherosa Ziehau.Dv NULL , 590ca59c34SSepherosa Ziehauthe lwp name will be set to the process name, 600ca59c34SSepherosa Ziehauwhich is the default name of the lwp. 610ca59c34SSepherosa ZiehauThe 620ca59c34SSepherosa Ziehau.Fa name 630ca59c34SSepherosa Ziehauwill be truncated, 640ca59c34SSepherosa Ziehauif it is longer than 650ca59c34SSepherosa Ziehau.Dv MAXCOMLEN . 66eb396e51SMatthew Dillon.Pp 67eb396e51SMatthew DillonThe 68eb396e51SMatthew Dillon.Fn lwp_getname 69eb396e51SMatthew Dillonsystem call gets the lwp name, storing it in the supplied 70eb396e51SMatthew Dillonbuffer up to (len - 1) characters plus the terminator. 71eb396e51SMatthew DillonThe buffer will always be terminated. 720ca59c34SSepherosa Ziehau.Sh RETURN VALUES 730ca59c34SSepherosa ZiehauThis system call returns \-1 on error and 740ca59c34SSepherosa Ziehau0 upon successful completion. 750ca59c34SSepherosa Ziehau.Sh ERRORS 760ca59c34SSepherosa ZiehauThe 770ca59c34SSepherosa Ziehau.Fn lwp_setname 780ca59c34SSepherosa Ziehausystem call will fail if: 790ca59c34SSepherosa Ziehau.Bl -tag -width Er 800ca59c34SSepherosa Ziehau.It Bq Er EFAULT 810ca59c34SSepherosa ZiehauThe 820ca59c34SSepherosa Ziehau.Fa name 830ca59c34SSepherosa Ziehauparameter is outside the process's allocated address space. 84d0fbc8aaSSascha Wildner.El 850ca59c34SSepherosa Ziehau.Sh SEE ALSO 86b0a405dbSSascha Wildner.Xr lwp_create 2 , 870ca59c34SSepherosa Ziehau.Xr setproctitle 3 880ca59c34SSepherosa Ziehau.Sh HISTORY 890ca59c34SSepherosa ZiehauThe 900ca59c34SSepherosa Ziehau.Fn lwp_setname 910ca59c34SSepherosa Ziehaufunction first appeared in 920ca59c34SSepherosa Ziehau.Dx 4.3 . 93