Back to index

php5  5.3.10
Classes | Defines | Enumerations | Functions
fpm_conf.h File Reference
#include <stdint.h>
#include "php.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  key_value_s
struct  fpm_global_config_s
struct  fpm_worker_pool_config_s
struct  ini_value_parser_s

Defines

#define PM2STR(a)   (a == PM_STYLE_STATIC ? "static" : (a == PM_STYLE_DYNAMIC ? "dynamic" : "ondemand"))
#define FPM_CONF_MAX_PONG_LENGTH   64

Enumerations

enum  { PM_STYLE_STATIC = 1, PM_STYLE_DYNAMIC = 2, PM_STYLE_ONDEMAND = 3 }

Functions

int fpm_conf_init_main (int test_conf)
int fpm_worker_pool_config_free (struct fpm_worker_pool_config_s *wpc)
int fpm_conf_write_pid ()
int fpm_conf_unlink_pid ()

Class Documentation

struct key_value_s

Definition at line 17 of file fpm_conf.h.

Collaboration diagram for key_value_s:
Class Members
char * key
struct key_value_s * next
char * value
struct fpm_global_config_s

Definition at line 26 of file fpm_conf.h.

Class Members
int daemonize
int emergency_restart_interval
int emergency_restart_threshold
char * error_log
char * events_mechanism
int log_level
char * pid_file
int process_control_timeout
int process_max
int rlimit_core
int rlimit_files
struct fpm_worker_pool_config_s

Definition at line 49 of file fpm_conf.h.

Collaboration diagram for fpm_worker_pool_config_s:
Class Members
char * access_format
char * access_log
int catch_workers_output
char * chdir
char * chroot
struct key_value_s * env
char * group
char * listen_address
char * listen_allowed_clients
int listen_backlog
char * listen_group
char * listen_mode
char * listen_owner
char * name
struct key_value_s * php_admin_values
struct key_value_s * php_values
char * ping_path
char * ping_response
int pm
int pm_max_children
int pm_max_requests
int pm_max_spare_servers
int pm_min_spare_servers
int pm_process_idle_timeout
int pm_start_servers
char * pm_status_path
char * prefix
int request_slowlog_timeout
int request_terminate_timeout
int rlimit_core
int rlimit_files
char * security_limit_extensions
char * slowlog
char * user

Define Documentation

#define FPM_CONF_MAX_PONG_LENGTH   64

Definition at line 13 of file fpm_conf.h.

#define PM2STR (   a)    (a == PM_STYLE_STATIC ? "static" : (a == PM_STYLE_DYNAMIC ? "dynamic" : "ondemand"))

Definition at line 11 of file fpm_conf.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
PM_STYLE_STATIC 
PM_STYLE_DYNAMIC 
PM_STYLE_ONDEMAND 

Definition at line 92 of file fpm_conf.h.


Function Documentation

int fpm_conf_init_main ( int  test_conf)

Definition at line 1543 of file fpm_conf.c.

{
       int ret;
       TSRMLS_FETCH();

       if (fpm_globals.prefix && *fpm_globals.prefix) {
              if (!fpm_conf_is_dir(fpm_globals.prefix)) {
                     zlog(ZLOG_ERROR, "the global prefix '%s' does not exist or is not a directory", fpm_globals.prefix);
                     return -1;
              }
       }

       if (fpm_globals.pid && *fpm_globals.pid) {
              fpm_global_config.pid_file = strdup(fpm_globals.pid);
       }

       if (fpm_globals.config == NULL) {
              char *tmp;

              if (fpm_globals.prefix == NULL) {
                     spprintf(&tmp, 0, "%s/php-fpm.conf", PHP_SYSCONFDIR);
              } else {
                     spprintf(&tmp, 0, "%s/etc/php-fpm.conf", fpm_globals.prefix);
              }

              if (!tmp) {
                     zlog(ZLOG_SYSERROR, "spprintf() failed (tmp for fpm_globals.config)");
                     return -1;
              }

              fpm_globals.config = strdup(tmp);
              efree(tmp);

              if (!fpm_globals.config) {
                     zlog(ZLOG_SYSERROR, "spprintf() failed (fpm_globals.config)");
                     return -1;
              }
       }

       ret = fpm_conf_load_ini_file(fpm_globals.config TSRMLS_CC);

       if (0 > ret) {
              zlog(ZLOG_ERROR, "failed to load configuration file '%s'", fpm_globals.config);
              return -1;
       }

       if (0 > fpm_conf_post_process(TSRMLS_C)) {
              zlog(ZLOG_ERROR, "failed to post process the configuration");
              return -1;
       }

       if (test_conf) {
              if (test_conf > 1) {
                     fpm_conf_dump();
              }
              zlog(ZLOG_NOTICE, "configuration file %s test is successful\n", fpm_globals.config);
              fpm_globals.test_successful = 1;
              return -1;
       }

       if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_conf_cleanup, 0)) {
              return -1;
       }

       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1051 of file fpm_conf.c.

{
       if (fpm_global_config.pid_file) {
              if (0 > unlink(fpm_global_config.pid_file)) {
                     zlog(ZLOG_SYSERROR, "Unable to remove the PID file (%s).", fpm_global_config.pid_file);
                     return -1;
              }
       }
       return 0;
}

Here is the caller graph for this function:

Definition at line 1063 of file fpm_conf.c.

{
       int fd;

       if (fpm_global_config.pid_file) {
              char buf[64];
              int len;

              unlink(fpm_global_config.pid_file);
              fd = creat(fpm_global_config.pid_file, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);

              if (fd < 0) {
                     zlog(ZLOG_SYSERROR, "Unable to create the PID file (%s).", fpm_global_config.pid_file);
                     return -1;
              }

              len = sprintf(buf, "%d", (int) fpm_globals.parent_pid);

              if (len != write(fd, buf, len)) {
                     zlog(ZLOG_SYSERROR, "Unable to write to the PID file.");
                     return -1;
              }
              close(fd);
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 599 of file fpm_conf.c.

{
       struct key_value_s *kv, *kv_next;

       free(wpc->name);
       free(wpc->prefix);
       free(wpc->user);
       free(wpc->group);
       free(wpc->listen_address);
       free(wpc->listen_owner);
       free(wpc->listen_group);
       free(wpc->listen_mode);
       free(wpc->listen_allowed_clients);
       free(wpc->pm_status_path);
       free(wpc->ping_path);
       free(wpc->ping_response);
       free(wpc->access_log);
       free(wpc->access_format);
       free(wpc->slowlog);
       free(wpc->chroot);
       free(wpc->chdir);
       free(wpc->security_limit_extensions);

       for (kv = wpc->php_values; kv; kv = kv_next) {
              kv_next = kv->next;
              free(kv->key);
              free(kv->value);
              free(kv);
       }
       for (kv = wpc->php_admin_values; kv; kv = kv_next) {
              kv_next = kv->next;
              free(kv->key);
              free(kv->value);
              free(kv);
       }
       for (kv = wpc->env; kv; kv = kv_next) {
              kv_next = kv->next;
              free(kv->key);
              free(kv->value);
              free(kv);
       }

       return 0;
}

Here is the caller graph for this function: