1*a9fa9459Szrj /* Set the title of a process.
2*a9fa9459Szrj Copyright (C) 2010, 2011 Free Software Foundation, Inc.
3*a9fa9459Szrj
4*a9fa9459Szrj This file is part of the libiberty library.
5*a9fa9459Szrj Libiberty is free software; you can redistribute it and/or
6*a9fa9459Szrj modify it under the terms of the GNU Library General Public
7*a9fa9459Szrj License as published by the Free Software Foundation; either
8*a9fa9459Szrj version 2 of the License, or (at your option) any later version.
9*a9fa9459Szrj
10*a9fa9459Szrj Libiberty is distributed in the hope that it will be useful,
11*a9fa9459Szrj but WITHOUT ANY WARRANTY; without even the implied warranty of
12*a9fa9459Szrj MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13*a9fa9459Szrj Library General Public License for more details.
14*a9fa9459Szrj
15*a9fa9459Szrj You should have received a copy of the GNU Library General Public
16*a9fa9459Szrj License along with libiberty; see the file COPYING.LIB. If not,
17*a9fa9459Szrj write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
18*a9fa9459Szrj Boston, MA 02110-1301, USA. */
19*a9fa9459Szrj
20*a9fa9459Szrj #ifdef HAVE_CONFIG_H
21*a9fa9459Szrj #include "config.h"
22*a9fa9459Szrj #endif
23*a9fa9459Szrj #ifdef HAVE_SYS_PRCTL_H
24*a9fa9459Szrj #include <sys/types.h>
25*a9fa9459Szrj #include <sys/prctl.h>
26*a9fa9459Szrj #endif
27*a9fa9459Szrj #include "ansidecl.h"
28*a9fa9459Szrj
29*a9fa9459Szrj /*
30*a9fa9459Szrj
31*a9fa9459Szrj @deftypefn Supplemental void setproctitle (const char *@var{fmt}, ...)
32*a9fa9459Szrj
33*a9fa9459Szrj Set the title of a process to @var{fmt}. va args not supported for now,
34*a9fa9459Szrj but defined for compatibility with BSD.
35*a9fa9459Szrj
36*a9fa9459Szrj @end deftypefn
37*a9fa9459Szrj
38*a9fa9459Szrj */
39*a9fa9459Szrj
40*a9fa9459Szrj void
setproctitle(const char * name ATTRIBUTE_UNUSED,...)41*a9fa9459Szrj setproctitle (const char *name ATTRIBUTE_UNUSED, ...)
42*a9fa9459Szrj {
43*a9fa9459Szrj #ifdef PR_SET_NAME
44*a9fa9459Szrj /* On GNU/Linux this sets the top visible "comm", but not
45*a9fa9459Szrj necessarily the name visible in ps. */
46*a9fa9459Szrj prctl (PR_SET_NAME, name);
47*a9fa9459Szrj #endif
48*a9fa9459Szrj }
49