LWP_SETNAME(2)

NAME
lwp_setname, lwp_getname - set or retrieve the lwp name that shows up in ps

LIBRARY
libc

SYNOPSIS
#include <sys/lwp.h>
int
lwp_setname(lwpid_t tid, const char *name);
int
lwp_getname(lwpid_t tid, char *name, size_t len);

DESCRIPTION
The lwp_setname() system call sets the lwp name. The lwp is in the process calling this system call, and the lwp is specified by tid. If the name is NULL, the lwp name will be set to the process name, which is the default name of the lwp. The name will be truncated, if it is longer than MAXCOMLEN.

The 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.

RETURN VALUES
This system call returns -1 on error and 0 upon successful completion.

ERRORS
The lwp_setname() system call will fail if:

[EFAULT]
    The name parameter is outside the process's allocated address space.

SEE ALSO
lwp_create(2), setproctitle(3)

HISTORY
The lwp_setname() function first appeared in DragonFly 4.3.