1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Use setproctitle_fast() to update the ps status, if available.

FreeBSD has introduced a faster variant of setproctitle().  Use it,
where available.

Author: Thomas Munro
Discussion: https://postgr.es/m/CAEepm=1wKMTi81uodJ=1KbJAz5WedOg=cr8ewEXrUFeaxWEgww@mail.gmail.com
This commit is contained in:
Thomas Munro
2018-07-24 13:09:22 +12:00
parent 3214463228
commit 1bc180cd2a
4 changed files with 14 additions and 4 deletions

View File

@ -38,6 +38,9 @@ bool update_process_title = true;
/*
* Alternative ways of updating ps display:
*
* PS_USE_SETPROCTITLE_FAST
* use the function setproctitle_fast(const char *, ...)
* (newer FreeBSD systems)
* PS_USE_SETPROCTITLE
* use the function setproctitle(const char *, ...)
* (newer BSD systems)
@ -59,7 +62,9 @@ bool update_process_title = true;
* don't update ps display
* (This is the default, as it is safest.)
*/
#if defined(HAVE_SETPROCTITLE)
#if defined(HAVE_SETPROCTITLE_FAST)
#define PS_USE_SETPROCTITLE_FAST
#elif defined(HAVE_SETPROCTITLE)
#define PS_USE_SETPROCTITLE
#elif defined(HAVE_PSTAT) && defined(PSTAT_SETCMD)
#define PS_USE_PSTAT
@ -286,7 +291,7 @@ init_ps_display(const char *username, const char *dbname,
* Make fixed prefix of ps display.
*/
#ifdef PS_USE_SETPROCTITLE
#if defined(PS_USE_SETPROCTITLE) || defined(PS_USE_SETPROCTITLE_FAST)
/*
* apparently setproctitle() already adds a `progname:' prefix to the ps
@ -349,6 +354,8 @@ set_ps_display(const char *activity, bool force)
#ifdef PS_USE_SETPROCTITLE
setproctitle("%s", ps_buffer);
#elif defined(PS_USE_SETPROCTITLE_FAST)
setproctitle_fast("%s", ps_buffer);
#endif
#ifdef PS_USE_PSTAT

View File

@ -489,6 +489,9 @@
/* Define to 1 if you have the `setproctitle' function. */
#undef HAVE_SETPROCTITLE
/* Define to 1 if you have the `setproctitle_fast' function. */
#undef HAVE_SETPROCTITLE_FAST
/* Define to 1 if you have the `setsid' function. */
#undef HAVE_SETSID