1 .\" Copyright (c) 1995 Peter Wemm <peter@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, is permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice immediately at the beginning of the file, without modification,
9 .\" this list of conditions, and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. This work was done expressly for inclusion into FreeBSD. Other use
14 .\" is permitted provided this notation is included.
15 .\" 4. Absolutely no warranty of function or purpose is made by the author
17 .\" 5. Modifications may be freely made to this file providing the above
18 .\" conditions are met.
22 .\" The following requests are required for all man pages.
33 .Fn setproctitle "const char *fmt" "..."
35 .Fn setproctitle_fast "const char *fmt" "..."
39 library routine sets the process title that appears on the
44 variant is optimized for high frequency updates, but may make the
46 command slightly slower by not updating the kernel cache of the program
49 The title is set from the executable's name, followed by the
52 style expansion of the arguments as specified by the
57 argument begins with a
59 character, the executable's name is skipped.
63 is NULL, the process title is restored.
65 To set the title on a daemon to indicate its activity:
66 .Bd -literal -offset indent
67 setproctitle("talking to %s", inet_ntoa(addr));
79 is implicitly non-standard.
80 Other methods of causing the
82 command line to change, including copying over the argv[0] string are
83 also implicitly non-portable.
84 It is preferable to use an operating system
89 Unfortunately, it is possible that there are other calling conventions
92 although none have been found by the author as yet.
93 This is believed to be
94 the predominant convention.
96 It is thought that the implementation is compatible with other systems,
108 .Fn setproctitle_fast
109 function first appeared in
111 Other operating systems have
115 .An Peter Wemm Aq Mt peter@FreeBSD.org
116 stole the idea from the
119 .An Eric Allman Aq Mt eric@sendmail.org .
121 Never pass a string with user-supplied data as a format without using
123 An attacker can put format specifiers in the string to mangle your stack,
124 leading to a possible security hole.
125 This holds true even if the string was built using a function like
127 as the resulting string may still contain user-supplied conversion specifiers
128 for later interpolation by
131 Always use the proper secure idiom:
133 .Dl setproctitle("%s", string);