mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
0675e24de0
(if it's able).
102 lines
2.7 KiB
Groff
102 lines
2.7 KiB
Groff
.\" Copyright (c) 1995 Peter Wemm <peter@freebsd.org>
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, is permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice immediately at the beginning of the file, without modification,
|
|
.\" 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. This work was done expressly for inclusion into FreeBSD. Other use
|
|
.\" is permitted provided this notation is included.
|
|
.\" 4. Absolutely no warranty of function or purpose is made by the author
|
|
.\" Peter Wemm.
|
|
.\" 5. Modifications may be freely made to this file providing the above
|
|
.\" conditions are met.
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.\"
|
|
.\" The following requests are required for all man pages.
|
|
.Dd December 16, 1995
|
|
.Os FreeBSD
|
|
.Dt SETPROCTITLE 3
|
|
.Sh NAME
|
|
.Nm setproctitle
|
|
.Nd set the process title for
|
|
.Xr ps 1
|
|
.Sh SYNOPSIS
|
|
.Fd #include <sys/types.h>
|
|
.Fd #include <libutil.h>
|
|
.Ft void
|
|
.Fn setproctitle "const char *fmt" "..."
|
|
.Pp
|
|
Link with
|
|
.Va -lutil
|
|
on the
|
|
.Xr cc 1
|
|
command line.
|
|
.Sh DESCRIPTION
|
|
The
|
|
.Fn setproctitle
|
|
library routine sets the process title that appears on the
|
|
.Xr ps 1
|
|
command.
|
|
.Pp
|
|
The title is set from the executable's name, followed by the
|
|
result of a
|
|
.Xr printf 3
|
|
style expansion of the arguments as specified by the
|
|
.Va fmt
|
|
argument.
|
|
.Pp
|
|
If
|
|
.Va fmt
|
|
is NULL, the process title is restored.
|
|
.Sh EXAMPLES
|
|
To set the title on a daemon to indicate its activity:
|
|
.Bd -literal -offset indent
|
|
setproctitle("talking to %s", inet_ntoa(addr));
|
|
.Ed
|
|
.Sh SEE ALSO
|
|
.Xr ps 1 ,
|
|
.Xr w 1 ,
|
|
.Xr kvm 3 ,
|
|
.Xr kvm_getargv 3 ,
|
|
.Xr printf 3
|
|
.Sh STANDARDS
|
|
.Fn setproctitle
|
|
is implicitly non-standard. Other methods of causing the
|
|
.Xr ps 1
|
|
command line to change, including copying over the argv[0] string are
|
|
also implicitly non-portable. It is preferable to use an operating system
|
|
supplied
|
|
.Fn setproctitle
|
|
if present.
|
|
.Pp
|
|
Unfortunately, it is possible that there are other calling conventions
|
|
to other versions of
|
|
.Fn setproctitle ,
|
|
although none have been found by the author as yet. This is believed to be
|
|
the predominant convention.
|
|
.Pp
|
|
It is thought that the implementation is compatible with other systems,
|
|
including
|
|
.Nx
|
|
and
|
|
.Tn BSD/OS .
|
|
.Sh HISTORY
|
|
.Fn setproctitle
|
|
first appeared in
|
|
.Fx 2.2 .
|
|
Other operating systems have
|
|
similar functions.
|
|
.Sh AUTHORS
|
|
.An Peter Wemm Aq peter@FreeBSD.org
|
|
stole the idea from the
|
|
.Sy "Sendmail 8.7.3"
|
|
source code by
|
|
.An Eric Allman Aq eric@sendmail.org .
|