Mercurial > hg > nginx
annotate src/os/unix/ngx_linux_init.c @ 2213:8cc552c91cd2
bump version
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 26 Aug 2008 17:23:27 +0000 |
parents | cf148caa9347 |
children | d620f497c50f |
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 |
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
|
4 */ |
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 |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #include <ngx_config.h> |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_core.h> |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
1605
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
11 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
|
12 u_char ngx_linux_kern_osrelease[50]; |
673 | 13 |
1921
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
14 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
|
15 |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 |
539 | 17 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
|
18 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
|
19 ngx_readv_chain, |
1689 | 20 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
|
21 ngx_unix_send, |
469 | 22 #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
|
23 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
|
24 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
|
25 #else |
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
26 ngx_writev_chain, |
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
27 0 |
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
28 #endif |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 }; |
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 |
493 | 32 ngx_int_t |
539 | 33 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
|
34 { |
1605
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
35 struct utsname u; |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 |
1605
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
37 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
|
38 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
|
39 return NGX_ERROR; |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
40 } |
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
41 |
1605
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
42 (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
|
43 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
|
44 |
1605
379ee44a4456
use uname(2) instead of /proc/, this allows to run nginx in chroot
Igor Sysoev <igor@sysoev.ru>
parents:
958
diff
changeset
|
45 (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
|
46 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
|
47 |
1921
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
48 #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
|
49 { |
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
50 int name[2]; |
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
51 size_t len; |
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
52 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
|
53 |
673 | 54 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
|
55 name[1] = KERN_RTSIGMAX; |
450 | 56 len = sizeof(ngx_linux_rtsig_max); |
493 | 57 |
58 if (sysctl(name, 2, &ngx_linux_rtsig_max, &len, NULL, 0) == -1) { | |
467 | 59 err = ngx_errno; |
60 | |
673 | 61 if (err != NGX_ENOTDIR && err != NGX_ENOSYS) { |
467 | 62 ngx_log_error(NGX_LOG_ALERT, log, err, |
63 "sysctl(KERN_RTSIGMAX) failed"); | |
64 | |
65 return NGX_ERROR; | |
66 } | |
67 | |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
68 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
|
69 } |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
312
diff
changeset
|
70 |
1921
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
71 } |
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
72 #endif |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
312
diff
changeset
|
73 |
539 | 74 ngx_os_io = ngx_linux_io; |
75 | |
76 return NGX_OK; | |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
77 } |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
78 |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
79 |
493 | 80 void |
539 | 81 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
|
82 { |
531 | 83 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
|
84 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
|
85 |
1921
cf148caa9347
disable rtsig automatic building in post 2.6.18 Linux kernels
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
86 #if (NGX_HAVE_RTSIG) |
531 | 87 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
|
88 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
|
89 #endif |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
90 } |