comparison src/os/unix/ngx_process.c @ 482:392c16f2d858 NGINX_0_7_53

nginx 0.7.53 *) Change: now a log set by --error-log-path is created from the very start-up. *) Feature: now the start up errors and warnings are outputted to an error_log and stderr. *) Feature: the empty --prefix= configure parameter forces nginx to use a directory where it was run as prefix. *) Feature: the -p switch. *) Feature: the -s switch on Unix platforms. *) Feature: the -? and -h switches. Thanks to Jerome Loyet. *) Feature: now switches may be set in condensed form. *) Bugfix: nginx/Windows did not work if configuration file was given by the -c switch. *) Bugfix: temporary files might be not removed if the "proxy_store", "fastcgi_store", "proxy_cache", or "fastcgi_cache" were used. Thanks to Maxim Dounin. *) Bugfix: an incorrect value was passed to mail proxy authentication server in "Auth-Method" header line; the bug had appeared in 0.7.34. Thanks to Simon Lecaille. *) Bugfix: system error text descriptions were not logged on Linux; the bug had appeared in 0.7.45. *) Bugfix: the "fastcgi_cache_min_uses" directive did not work. Thanks to Andrew Vorobyoff.
author Igor Sysoev <http://sysoev.ru>
date Mon, 27 Apr 2009 00:00:00 +0400
parents 33394d1255b0
children 43cc6f0b77ce
comparison
equal deleted inserted replaced
481:0c98173187ac 482:392c16f2d858
11 11
12 12
13 typedef struct { 13 typedef struct {
14 int signo; 14 int signo;
15 char *signame; 15 char *signame;
16 char *name;
16 void (*handler)(int signo); 17 void (*handler)(int signo);
17 } ngx_signal_t; 18 } ngx_signal_t;
18 19
19 20
20 21
34 35
35 36
36 ngx_signal_t signals[] = { 37 ngx_signal_t signals[] = {
37 { ngx_signal_value(NGX_RECONFIGURE_SIGNAL), 38 { ngx_signal_value(NGX_RECONFIGURE_SIGNAL),
38 "SIG" ngx_value(NGX_RECONFIGURE_SIGNAL), 39 "SIG" ngx_value(NGX_RECONFIGURE_SIGNAL),
40 "reload",
39 ngx_signal_handler }, 41 ngx_signal_handler },
40 42
41 { ngx_signal_value(NGX_REOPEN_SIGNAL), 43 { ngx_signal_value(NGX_REOPEN_SIGNAL),
42 "SIG" ngx_value(NGX_REOPEN_SIGNAL), 44 "SIG" ngx_value(NGX_REOPEN_SIGNAL),
45 "reopen",
43 ngx_signal_handler }, 46 ngx_signal_handler },
44 47
45 { ngx_signal_value(NGX_NOACCEPT_SIGNAL), 48 { ngx_signal_value(NGX_NOACCEPT_SIGNAL),
46 "SIG" ngx_value(NGX_NOACCEPT_SIGNAL), 49 "SIG" ngx_value(NGX_NOACCEPT_SIGNAL),
50 "",
47 ngx_signal_handler }, 51 ngx_signal_handler },
48 52
49 { ngx_signal_value(NGX_TERMINATE_SIGNAL), 53 { ngx_signal_value(NGX_TERMINATE_SIGNAL),
50 "SIG" ngx_value(NGX_TERMINATE_SIGNAL), 54 "SIG" ngx_value(NGX_TERMINATE_SIGNAL),
55 "stop",
51 ngx_signal_handler }, 56 ngx_signal_handler },
52 57
53 { ngx_signal_value(NGX_SHUTDOWN_SIGNAL), 58 { ngx_signal_value(NGX_SHUTDOWN_SIGNAL),
54 "SIG" ngx_value(NGX_SHUTDOWN_SIGNAL), 59 "SIG" ngx_value(NGX_SHUTDOWN_SIGNAL),
60 "quit",
55 ngx_signal_handler }, 61 ngx_signal_handler },
56 62
57 { ngx_signal_value(NGX_CHANGEBIN_SIGNAL), 63 { ngx_signal_value(NGX_CHANGEBIN_SIGNAL),
58 "SIG" ngx_value(NGX_CHANGEBIN_SIGNAL), 64 "SIG" ngx_value(NGX_CHANGEBIN_SIGNAL),
65 "",
59 ngx_signal_handler }, 66 ngx_signal_handler },
60 67
61 { SIGALRM, "SIGALRM", ngx_signal_handler }, 68 { SIGALRM, "SIGALRM", "", ngx_signal_handler },
62 69
63 { SIGINT, "SIGINT", ngx_signal_handler }, 70 { SIGINT, "SIGINT", "", ngx_signal_handler },
64 71
65 { SIGIO, "SIGIO", ngx_signal_handler }, 72 { SIGIO, "SIGIO", "", ngx_signal_handler },
66 73
67 { SIGCHLD, "SIGCHLD", ngx_signal_handler }, 74 { SIGCHLD, "SIGCHLD", "", ngx_signal_handler },
68 75
69 { SIGPIPE, "SIGPIPE, SIG_IGN", SIG_IGN }, 76 { SIGPIPE, "SIGPIPE, SIG_IGN", "", SIG_IGN },
70 77
71 { 0, NULL, NULL } 78 { 0, NULL, "", NULL }
72 }; 79 };
73 80
74 81
75 ngx_pid_t 82 ngx_pid_t
76 ngx_spawn_process(ngx_cycle_t *cycle, ngx_spawn_proc_pt proc, void *data, 83 ngx_spawn_process(ngx_cycle_t *cycle, ngx_spawn_proc_pt proc, void *data,
538 545
539 case NGX_DEBUG_POINTS_ABORT: 546 case NGX_DEBUG_POINTS_ABORT:
540 ngx_abort(); 547 ngx_abort();
541 } 548 }
542 } 549 }
550
551
552 ngx_int_t
553 ngx_os_signal_process(ngx_cycle_t *cycle, char *name, ngx_int_t pid)
554 {
555 ngx_signal_t *sig;
556
557 for (sig = signals; sig->signo != 0; sig++) {
558 if (ngx_strcmp(name, sig->name) == 0) {
559 if (kill(pid, sig->signo) != -1) {
560 return 0;
561 }
562
563 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
564 "kill(%P, %d) failed", pid, sig->signo);
565 }
566 }
567
568 return 1;
569 }