Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sapi/fpm/fpm/fpm_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static const struct ini_value_parser_s ini_fpm_global_options[] = {
#ifdef HAVE_SYSTEMD
{ "systemd_interval", &fpm_conf_set_time, GO(systemd_interval) },
#endif
{ "proctitle_prefix", &fpm_conf_set_string, GO(proctitle_prefix) },
{ 0, 0, 0 }
};

Expand Down
1 change: 1 addition & 0 deletions sapi/fpm/fpm/fpm_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct fpm_global_config_s {
int systemd_watchdog;
int systemd_interval;
#endif
char *proctitle_prefix;
};

extern struct fpm_global_config_s fpm_global_config;
Expand Down
6 changes: 3 additions & 3 deletions sapi/fpm/fpm/fpm_env.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ void fpm_env_setproctitle(char *title) /* {{{ */
#elif defined(HAVE_SETPROCTITLE)
setproctitle("%s", title);
#elif defined(__linux__) || defined(__APPLE__)
size_t prefixlen = strlen(SETPROCTITLE_PREFIX);
char *proctitle_prefix = fpm_global_config.proctitle_prefix ? fpm_global_config.proctitle_prefix : SETPROCTITLE_PREFIX;
size_t prefixlen = strlen(proctitle_prefix);
if (fpm_env_argv != NULL && fpm_env_argv_len > prefixlen + 3) {
memset(fpm_env_argv[0], 0, fpm_env_argv_len);
strncpy(fpm_env_argv[0], SETPROCTITLE_PREFIX, fpm_env_argv_len - 2);
strncpy(fpm_env_argv[0] + prefixlen, title, fpm_env_argv_len - prefixlen - 2);
snprintf(fpm_env_argv[0], fpm_env_argv_len - 2, "%s: %s", proctitle_prefix, title);
fpm_env_argv[1] = NULL;
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion sapi/fpm/fpm/fpm_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "fpm_worker_pool.h"

#define SETPROCTITLE_PREFIX "php-fpm: "
#define SETPROCTITLE_PREFIX "php-fpm"

int fpm_env_init_child(struct fpm_worker_pool_s *wp);
int fpm_env_init_main(void);
Expand Down
4 changes: 4 additions & 0 deletions sapi/fpm/php-fpm.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@
; Default value: 10
;systemd_interval = 10

; Set the process prefix name
; Default value: php-fpm
;proctitle_prefix = FPM1

;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;
Expand Down
Loading