comparison src/os/unix/ngx_process.c @ 360:239e37d44a34

nginx-0.0.7-2004-06-18-20:22:16 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 18 Jun 2004 16:22:16 +0000
parents 0fb6c53fb135
children fd24ba70e1b3
comparison
equal deleted inserted replaced
359:a3e622ab7ee7 360:239e37d44a34
4 #include <ngx_event.h> 4 #include <ngx_event.h>
5 5
6 6
7 static void ngx_execute_proc(ngx_cycle_t *cycle, void *data); 7 static void ngx_execute_proc(ngx_cycle_t *cycle, void *data);
8 8
9 ngx_int_t ngx_current_slot; 9 ngx_int_t ngx_process_slot;
10 ngx_socket_t ngx_channel;
10 ngx_int_t ngx_last_process; 11 ngx_int_t ngx_last_process;
11 ngx_socket_t ngx_channel;
12 ngx_process_t ngx_processes[NGX_MAX_PROCESSES]; 12 ngx_process_t ngx_processes[NGX_MAX_PROCESSES];
13 13
14 14
15 ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, 15 ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle,
16 ngx_spawn_proc_pt proc, void *data, 16 ngx_spawn_proc_pt proc, void *data,
29 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 29 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
30 "socketpair() failed while spawning \"%s\"", name); 30 "socketpair() failed while spawning \"%s\"", name);
31 return NGX_ERROR; 31 return NGX_ERROR;
32 } 32 }
33 33
34 if (ngx_nonblocking(ngx_processes[s].channel[0]) == -1) {
35 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
36 ngx_nonblocking_n " failed while spawning \"%s\"", name);
37 return NGX_ERROR;
38 }
39
40 if (ngx_nonblocking(ngx_processes[s].channel[1]) == -1) {
41 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
42 ngx_nonblocking_n " failed while spawning \"%s\"", name);
43 return NGX_ERROR;
44 }
45
34 on = 1; 46 on = 1;
35 if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) { 47 if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) {
36 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 48 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
37 "ioctl(FIOASYNC) failed while spawning \"%s\"", name); 49 "ioctl(FIOASYNC) failed while spawning \"%s\"", name);
38 return NGX_ERROR; 50 return NGX_ERROR;
43 "fcntl(F_SETOWN) failed while spawning \"%s\"", name); 55 "fcntl(F_SETOWN) failed while spawning \"%s\"", name);
44 return NGX_ERROR; 56 return NGX_ERROR;
45 } 57 }
46 58
47 ngx_channel = ngx_processes[s].channel[1]; 59 ngx_channel = ngx_processes[s].channel[1];
48 ngx_current_slot = s; 60 ngx_process_slot = s;
49 61
50 62
51 pid = fork(); 63 pid = fork();
52 64
53 switch (pid) { 65 switch (pid) {