setproctitle3
Set process title
Usage
#include <sys/types.h>
#include <bsd/unistd.h>
void
setproctitle_init(int argc, char *argv[], char *envp[]);
void
setproctitle(const char *fmt, ...);
Library
library “libbsd”
Overview
The setproctitle() library routine sets the process title that appears on the ps(1) command.
The setproctitle_init() library routine only needs to be called (before any call to setproctitle() and with main() arguments), if the automatic constructor support has not been linked in through the libbsd-ctor pkg-config file.
The title is set from the executable's name, followed by the result of a printf(3) style expansion of the arguments as specified by the fmt argument. If the fmt argument begins with a “-” character, the executable's name is skipped.
If fmt is NULL, the process title is restored.
Examples
To set the title on a daemon to indicate its activity:
setproctitle("talking to %s", inet_ntoa(addr));
Releases
3 releases since Debian 7 (Wheezy); the text changed 1 time.