setproctitle3
Set process title
Usage
#include <unistd.h>
void
setproctitle(const char *fmt, ...);
void
setproctitle_fast(const char *fmt, ...);
Overview
The setproctitle() library routine sets the process title that appears on the ps(1) command. The setproctitle_fast() variant is optimized for high frequency updates, but may make the ps(1) command slightly slower by not updating the kernel cache of the program arguments.
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
86 releases since FreeBSD 2.1.5-RELEASE; the text changed 50 times.