File indexing completed on 2024-04-21 14:59:31

0001 /*
0002     SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
0003     SPDX-FileCopyrightText: 2003 Damien Miller
0004     SPDX-FileCopyrightText: 1983, 1995-1997 Eric P. Allman
0005     SPDX-FileCopyrightText: 1988, 1993 The Regents of the University of California.  All rights reserved.
0006 
0007     SPDX-License-Identifier: BSD-3-Clause
0008 */
0009 
0010 #ifndef SETPROCTITLE_H
0011 #define SETPROCTITLE_H
0012 
0013 /**
0014  * Set up the data structures for changing the process title.
0015  *
0016  * This must be called before proctitle_set, and must not be called
0017  * multiple times.  Be warned that this function and proctitle_set may
0018  * alter the contents of argv, and so any argument parsing should be
0019  * done before calling this function.
0020  *
0021  * @param argc  argc, as passed to main()
0022  * @param argv  argv, as passed to main() (NB: this MUST NOT be a copy
0023  *              of argv!)
0024  */
0025 void proctitle_init(int argc, char *argv[]);
0026 
0027 /**
0028  * Set the process title that appears on the ps command.
0029  *
0030  * The title is set to the executable's name, followed by the result
0031  * of a printf-style expansion of the arguments as specified by the fmt
0032  * argument.  If fmt begins with a '-' character, the executable's name
0033  * is skipped (providing the platform implementation supports it;
0034  * OpenBSD and NetBSD do not).
0035  *
0036  * Note that proctitle_init must be called before using this function.
0037  */
0038 void proctitle_set(const char *fmt, ...);
0039 
0040 #endif // SETPROCTITLE_H