xref: /netbsd-src/external/gpl3/gcc/dist/libiberty/setproctitle.c (revision b1e838363e3c6fc78a55519254d99869742dd33c)
148fb7bfaSmrg /* Set the title of a process.
2*b1e83836Smrg    Copyright (C) 2010-2022 Free Software Foundation, Inc.
348fb7bfaSmrg 
448fb7bfaSmrg This file is part of the libiberty library.
548fb7bfaSmrg Libiberty is free software; you can redistribute it and/or
648fb7bfaSmrg modify it under the terms of the GNU Library General Public
748fb7bfaSmrg License as published by the Free Software Foundation; either
848fb7bfaSmrg version 2 of the License, or (at your option) any later version.
948fb7bfaSmrg 
1048fb7bfaSmrg Libiberty is distributed in the hope that it will be useful,
1148fb7bfaSmrg but WITHOUT ANY WARRANTY; without even the implied warranty of
1248fb7bfaSmrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1348fb7bfaSmrg Library General Public License for more details.
1448fb7bfaSmrg 
1548fb7bfaSmrg You should have received a copy of the GNU Library General Public
1648fb7bfaSmrg License along with libiberty; see the file COPYING.LIB.  If not,
1748fb7bfaSmrg write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
1848fb7bfaSmrg Boston, MA 02110-1301, USA.  */
1948fb7bfaSmrg 
2048fb7bfaSmrg #ifdef HAVE_CONFIG_H
2148fb7bfaSmrg #include "config.h"
2248fb7bfaSmrg #endif
2348fb7bfaSmrg #ifdef HAVE_SYS_PRCTL_H
2448fb7bfaSmrg #include <sys/types.h>
2548fb7bfaSmrg #include <sys/prctl.h>
2648fb7bfaSmrg #endif
2748fb7bfaSmrg #include "ansidecl.h"
2848fb7bfaSmrg 
2948fb7bfaSmrg /*
3048fb7bfaSmrg 
3148fb7bfaSmrg @deftypefn Supplemental void setproctitle (const char *@var{fmt}, ...)
3248fb7bfaSmrg 
3348fb7bfaSmrg Set the title of a process to @var{fmt}. va args not supported for now,
3448fb7bfaSmrg but defined for compatibility with BSD.
3548fb7bfaSmrg 
3648fb7bfaSmrg @end deftypefn
3748fb7bfaSmrg 
3848fb7bfaSmrg */
3948fb7bfaSmrg 
4048fb7bfaSmrg void
setproctitle(const char * name ATTRIBUTE_UNUSED,...)4148fb7bfaSmrg setproctitle (const char *name ATTRIBUTE_UNUSED, ...)
4248fb7bfaSmrg {
4348fb7bfaSmrg #ifdef PR_SET_NAME
4448fb7bfaSmrg   /* On GNU/Linux this sets the top visible "comm", but not
4548fb7bfaSmrg      necessarily the name visible in ps. */
4648fb7bfaSmrg   prctl (PR_SET_NAME, name);
4748fb7bfaSmrg #endif
4848fb7bfaSmrg }
49