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