Back to index

php5  5.3.10
Classes | Functions
fpm.h File Reference
#include <unistd.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fpm_globals_s

Functions

int fpm_run (int *max_requests)
int fpm_init (int argc, char **argv, char *config, char *prefix, char *pid, int test_conf)

Class Documentation

struct fpm_globals_s

Definition at line 13 of file fpm.h.

Class Members
int argc
char ** argv
char * config
int error_log_fd
int heartbeat
int is_child
int listening_socket
int log_level
int max_requests
pid_t parent_pid
char * pid
char * prefix
int running_children
int test_successful

Function Documentation

int fpm_init ( int  argc,
char **  argv,
char *  config,
char *  prefix,
char *  pid,
int  test_conf 
)

Definition at line 43 of file fpm.c.

{
       fpm_globals.argc = argc;
       fpm_globals.argv = argv;
       if (config && *config) {
              fpm_globals.config = strdup(config);
       }
       fpm_globals.prefix = prefix;
       fpm_globals.pid = pid;

       if (0 > fpm_php_init_main()           ||
           0 > fpm_stdio_init_main()         ||
           0 > fpm_conf_init_main(test_conf) ||
           0 > fpm_unix_init_main()          ||
           0 > fpm_scoreboard_init_main()    ||
           0 > fpm_pctl_init_main()          ||
           0 > fpm_env_init_main()           ||
           0 > fpm_signals_init_main()       ||
           0 > fpm_children_init_main()      ||
           0 > fpm_sockets_init_main()       ||
           0 > fpm_worker_pool_init_main()   ||
           0 > fpm_event_init_main()) {

              if (fpm_globals.test_successful) {
                     exit(0);
              } else {
                     zlog(ZLOG_ERROR, "FPM initialization failed");
                     return -1;
              }
       }

       if (0 > fpm_conf_write_pid()) {
              zlog(ZLOG_ERROR, "FPM initialization failed");
              return -1;
       }

       fpm_stdio_init_final();
       zlog(ZLOG_NOTICE, "fpm is running, pid %d", (int) fpm_globals.parent_pid);

       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int fpm_run ( int max_requests)

Definition at line 88 of file fpm.c.

{
       struct fpm_worker_pool_s *wp;

       /* create initial children in all pools */
       for (wp = fpm_worker_all_pools; wp; wp = wp->next) {
              int is_parent;

              is_parent = fpm_children_create_initial(wp);

              if (!is_parent) {
                     goto run_child;
              }

              /* handle error */
              if (is_parent == 2) {
                     fpm_pctl(FPM_PCTL_STATE_TERMINATING, FPM_PCTL_ACTION_SET);
                     fpm_event_loop(1);
              }
       }

       /* run event loop forever */
       fpm_event_loop(0);

run_child: /* only workers reach this point */

       fpm_cleanups_run(FPM_CLEANUP_CHILD);

       *max_requests = fpm_globals.max_requests;
       return fpm_globals.listening_socket;
}

Here is the call graph for this function:

Here is the caller graph for this function: