1995-12-26 22:50:08 +00:00
|
|
|
.\" 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.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1995-12-26 22:50:08 +00:00
|
|
|
.\"
|
|
|
|
.\" 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
|
1997-05-11 08:50:33 +00:00
|
|
|
.Fd #include <sys/types.h>
|
1996-08-23 20:52:53 +00:00
|
|
|
.Fd #include <libutil.h>
|
1995-12-26 22:50:08 +00:00
|
|
|
.Ft void
|
|
|
|
.Fn setproctitle "const char *fmt" "..."
|
1996-01-01 08:27:41 +00:00
|
|
|
.Pp
|
|
|
|
Link with
|
|
|
|
.Va -lutil
|
|
|
|
on the
|
|
|
|
.Xr cc 1
|
|
|
|
command line.
|
1995-12-26 22:50:08 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
1996-12-30 21:08:45 +00:00
|
|
|
.Fn setproctitle
|
1995-12-26 22:50:08 +00:00
|
|
|
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 reset to simply the name of the executable.
|
|
|
|
.\" The following requests should be uncommented and used where appropriate.
|
|
|
|
.\" This next request is for sections 2 and 3 function return values only.
|
|
|
|
.\" .Sh RETURN VALUES
|
|
|
|
.\" This next request is for sections 1, 6, 7 & 8 only
|
|
|
|
.\" .Sh ENVIRONMENT
|
|
|
|
.\" .Sh FILES
|
|
|
|
.Sh EXAMPLES
|
1997-04-17 23:31:47 +00:00
|
|
|
To set the title on a daemon to indicate its activity:
|
1995-12-26 22:50:08 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
setproctitle("talking to %s", inet_ntoa(addr));
|
|
|
|
.Ed
|
|
|
|
.\" This next request is for sections 1, 6, 7 & 8 only
|
|
|
|
.\" (command return values (to shell) and fprintf/stderr type diagnostics)
|
|
|
|
.\" .Sh DIAGNOSTICS
|
|
|
|
.\" The next request is for sections 2 and 3 error and signal handling only.
|
|
|
|
.\" .Sh ERRORS
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr ps 1 ,
|
|
|
|
.Xr w 1 ,
|
|
|
|
.Xr kvm 3 ,
|
|
|
|
.Xr kvm_getargv 3 ,
|
|
|
|
.Xr printf 3
|
|
|
|
.Sh STANDARDS
|
1996-12-30 21:08:45 +00:00
|
|
|
.Fn setproctitle
|
1995-12-26 22:50:08 +00:00
|
|
|
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
|
1996-12-30 21:08:45 +00:00
|
|
|
.Fn setproctitle
|
1995-12-26 22:50:08 +00:00
|
|
|
if present.
|
|
|
|
.Pp
|
|
|
|
Unfortunately, it is possible that there are other calling conventions
|
|
|
|
to other versions of
|
1996-12-30 21:08:45 +00:00
|
|
|
.Fn setproctitle ,
|
1995-12-26 22:50:08 +00:00
|
|
|
although none have been found by the author as yet. This is believed to be
|
|
|
|
the predominant convention.
|
|
|
|
.Pp
|
1996-01-30 18:13:11 +00:00
|
|
|
It is thought that the implementation is compatible with other systems,
|
1995-12-26 22:50:08 +00:00
|
|
|
including
|
1999-09-21 19:39:27 +00:00
|
|
|
.Nx
|
1995-12-26 22:50:08 +00:00
|
|
|
and
|
1996-08-23 20:52:53 +00:00
|
|
|
.Tn BSD/OS .
|
1995-12-26 22:50:08 +00:00
|
|
|
.Sh HISTORY
|
1996-12-30 21:08:45 +00:00
|
|
|
.Fn setproctitle
|
1996-08-23 20:52:53 +00:00
|
|
|
first appeared in
|
|
|
|
.Fx 2.2 .
|
|
|
|
Other operating systems have
|
1995-12-26 22:50:08 +00:00
|
|
|
similar functions.
|
|
|
|
.Sh AUTHORS
|
1998-03-19 07:34:22 +00:00
|
|
|
.An Peter Wemm Aq peter@FreeBSD.org
|
1995-12-26 22:50:08 +00:00
|
|
|
stole the idea from the
|
1996-08-23 20:52:53 +00:00
|
|
|
.Sy "Sendmail 8.7.3"
|
1995-12-26 22:50:08 +00:00
|
|
|
source code by
|
1998-03-19 07:34:22 +00:00
|
|
|
.An Eric Allman Aq eric@sendmail.org .
|
1995-12-26 22:50:08 +00:00
|
|
|
.\" .Sh BUGS
|