Mercurial > hg > nginx-quic
annotate src/os/unix/ngx_linux_init.c @ 5860:c9787372f16d
Limit conn: use complex value in limit_conn_zone (ticket #121).
One intentional side effect of this change is that key is allowed only
in the first position. Previously, it was possible to specify the key
variable at any position, but that was never documented, and is contrary
to nginx configuration practice for positional parameters.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Wed, 24 Sep 2014 21:55:19 +0400 |
parents | d620f497c50f |
children | adba26ff70b5 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
6 |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_config.h> |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #include <ngx_core.h> |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
1605
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
12 u_char ngx_linux_kern_ostype[50]; |
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
13 u_char ngx_linux_kern_osrelease[50]; |
673 | 14 |
1921
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
15 int ngx_linux_rtsig_max; |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
312
diff
changeset
|
16 |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
17 |
539 | 18 static ngx_os_io_t ngx_linux_io = { |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
19 ngx_unix_recv, |
312
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
20 ngx_readv_chain, |
1689 | 21 ngx_udp_unix_recv, |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
391
diff
changeset
|
22 ngx_unix_send, |
469 | 23 #if (NGX_HAVE_SENDFILE) |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
24 ngx_linux_sendfile_chain, |
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
25 NGX_IO_SENDFILE |
312
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
26 #else |
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
27 ngx_writev_chain, |
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
28 0 |
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
29 #endif |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
30 }; |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
31 |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
32 |
493 | 33 ngx_int_t |
539 | 34 ngx_os_specific_init(ngx_log_t *log) |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
35 { |
1605
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
36 struct utsname u; |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
37 |
1605
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
38 if (uname(&u) == -1) { |
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
39 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, "uname() failed"); |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
40 return NGX_ERROR; |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
41 } |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
42 |
1605
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
43 (void) ngx_cpystrn(ngx_linux_kern_ostype, (u_char *) u.sysname, |
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
44 sizeof(ngx_linux_kern_ostype)); |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
45 |
1605
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
46 (void) ngx_cpystrn(ngx_linux_kern_osrelease, (u_char *) u.release, |
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
47 sizeof(ngx_linux_kern_osrelease)); |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
48 |
1921
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
49 #if (NGX_HAVE_RTSIG) |
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
50 { |
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
51 int name[2]; |
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
52 size_t len; |
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
53 ngx_err_t err; |
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
54 |
673 | 55 name[0] = CTL_KERN; |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
312
diff
changeset
|
56 name[1] = KERN_RTSIGMAX; |
450 | 57 len = sizeof(ngx_linux_rtsig_max); |
493 | 58 |
59 if (sysctl(name, 2, &ngx_linux_rtsig_max, &len, NULL, 0) == -1) { | |
467 | 60 err = ngx_errno; |
61 | |
673 | 62 if (err != NGX_ENOTDIR && err != NGX_ENOSYS) { |
467 | 63 ngx_log_error(NGX_LOG_ALERT, log, err, |
64 "sysctl(KERN_RTSIGMAX) failed"); | |
65 | |
66 return NGX_ERROR; | |
67 } | |
68 | |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
69 ngx_linux_rtsig_max = 0; |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
312
diff
changeset
|
70 } |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
312
diff
changeset
|
71 |
1921
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
72 } |
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
73 #endif |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
312
diff
changeset
|
74 |
539 | 75 ngx_os_io = ngx_linux_io; |
76 | |
77 return NGX_OK; | |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
78 } |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
79 |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
80 |
493 | 81 void |
539 | 82 ngx_os_specific_status(ngx_log_t *log) |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
83 { |
531 | 84 ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s", |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
85 ngx_linux_kern_ostype, ngx_linux_kern_osrelease); |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
86 |
1921
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
87 #if (NGX_HAVE_RTSIG) |
531 | 88 ngx_log_error(NGX_LOG_NOTICE, log, 0, "sysctl(KERN_RTSIGMAX): %d", |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
89 ngx_linux_rtsig_max); |
1921
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
90 #endif |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
91 } |