Mercurial > hg > nginx
annotate src/os/unix/ngx_darwin_init.c @ 6470:62d950bc0f15
Updated OpenSSL used for win32 builds.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 29 Mar 2016 09:54:11 +0300 |
parents | 8f038068f4bc |
children | 56fc55e32f23 |
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:
437
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:
437
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:
437
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:
437
diff
changeset
|
6 |
86
3973260705cc
nginx-0.0.1-2003-05-12-19:52:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
183
4c698194c56d
nginx-0.0.1-2003-11-13-19:16:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
152
diff
changeset
|
8 #include <ngx_config.h> |
4c698194c56d
nginx-0.0.1-2003-11-13-19:16:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
152
diff
changeset
|
9 #include <ngx_core.h> |
86
3973260705cc
nginx-0.0.1-2003-05-12-19:52:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
3973260705cc
nginx-0.0.1-2003-05-12-19:52:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
12 char ngx_darwin_kern_ostype[16]; |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
13 char ngx_darwin_kern_osrelease[128]; |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
14 int ngx_darwin_hw_ncpu; |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
15 int ngx_darwin_kern_ipc_somaxconn; |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
16 u_long ngx_darwin_net_inet_tcp_sendspace; |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
17 |
4223
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
18 ngx_uint_t ngx_debug_malloc; |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
19 |
86
3973260705cc
nginx-0.0.1-2003-05-12-19:52:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
20 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
21 static ngx_os_io_t ngx_darwin_io = { |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
22 ngx_unix_recv, |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
23 ngx_readv_chain, |
1689 | 24 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
|
25 ngx_unix_send, |
6436 | 26 ngx_udp_unix_send, |
469 | 27 #if (NGX_HAVE_SENDFILE) |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
28 ngx_darwin_sendfile_chain, |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
29 NGX_IO_SENDFILE |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
30 #else |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
31 ngx_writev_chain, |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
32 0 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
33 #endif |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
34 }; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
35 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
36 |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
37 typedef struct { |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
38 char *name; |
673 | 39 void *value; |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
40 size_t size; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
41 ngx_uint_t exists; |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
42 } sysctl_t; |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
43 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
44 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
45 sysctl_t sysctls[] = { |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
46 { "hw.ncpu", |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
47 &ngx_darwin_hw_ncpu, |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
48 sizeof(ngx_darwin_hw_ncpu), 0 }, |
373
018569a8f09c
nginx-0.0.7-2004-06-30-19:30:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
361
diff
changeset
|
49 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
50 { "net.inet.tcp.sendspace", |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
51 &ngx_darwin_net_inet_tcp_sendspace, |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
52 sizeof(ngx_darwin_net_inet_tcp_sendspace), 0 }, |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
53 |
501 | 54 { "kern.ipc.somaxconn", |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
55 &ngx_darwin_kern_ipc_somaxconn, |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
56 sizeof(ngx_darwin_kern_ipc_somaxconn), 0 }, |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
57 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
58 { NULL, NULL, 0, 0 } |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
59 }; |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
60 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
61 |
4223
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
62 void |
5225
15a7deeaa19a
Use "void" for functions with empty parameter list.
Sergey Kandaurov <pluknet@nginx.com>
parents:
4412
diff
changeset
|
63 ngx_debug_init(void) |
4223
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
64 { |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
65 #if (NGX_DEBUG_MALLOC) |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
66 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
67 /* |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
68 * MacOSX 10.6, 10.7: MallocScribble fills freed memory with 0x55 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
69 * and fills allocated memory with 0xAA. |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
70 * MacOSX 10.4, 10.5: MallocScribble fills freed memory with 0x55, |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
71 * MallocPreScribble fills allocated memory with 0xAA. |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
72 * MacOSX 10.3: MallocScribble fills freed memory with 0x55, |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
73 * and no way to fill allocated memory. |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
74 */ |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
75 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
76 setenv("MallocScribble", "1", 0); |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
77 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
78 ngx_debug_malloc = 1; |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
79 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
80 #else |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
81 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
82 if (getenv("MallocScribble")) { |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
83 ngx_debug_malloc = 1; |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
84 } |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
85 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
86 #endif |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
87 } |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
88 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
89 |
539 | 90 ngx_int_t |
91 ngx_os_specific_init(ngx_log_t *log) | |
86
3973260705cc
nginx-0.0.1-2003-05-12-19:52:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
92 { |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
93 size_t size; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
94 ngx_err_t err; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
95 ngx_uint_t i; |
86
3973260705cc
nginx-0.0.1-2003-05-12-19:52:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
96 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
97 size = sizeof(ngx_darwin_kern_ostype); |
2303
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
98 if (sysctlbyname("kern.ostype", ngx_darwin_kern_ostype, &size, NULL, 0) |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
99 == -1) |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
100 { |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
101 err = ngx_errno; |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
102 |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
103 if (err != NGX_ENOENT) { |
461 | 104 |
2303
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
105 ngx_log_error(NGX_LOG_ALERT, log, err, |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
106 "sysctlbyname(kern.ostype) failed"); |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
107 |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
108 if (err != NGX_ENOMEM) { |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
109 return NGX_ERROR; |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
110 } |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
111 |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
112 ngx_darwin_kern_ostype[size - 1] = '\0'; |
461 | 113 } |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
114 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
115 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
116 size = sizeof(ngx_darwin_kern_osrelease); |
2303
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
117 if (sysctlbyname("kern.osrelease", ngx_darwin_kern_osrelease, &size, |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
118 NULL, 0) |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
119 == -1) |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
120 { |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
121 err = ngx_errno; |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
122 |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
123 if (err != NGX_ENOENT) { |
461 | 124 |
2303
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
125 ngx_log_error(NGX_LOG_ALERT, log, err, |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
126 "sysctlbyname(kern.osrelease) failed"); |
461 | 127 |
2303
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
128 if (err != NGX_ENOMEM) { |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
129 return NGX_ERROR; |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
130 } |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
131 |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
132 ngx_darwin_kern_osrelease[size - 1] = '\0'; |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
133 } |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
134 } |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
135 |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
136 for (i = 0; sysctls[i].name; i++) { |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
137 size = sysctls[i].size; |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
138 |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
139 if (sysctlbyname(sysctls[i].name, sysctls[i].value, &size, NULL, 0) |
673 | 140 == 0) |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
141 { |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
142 sysctls[i].exists = 1; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
143 continue; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
144 } |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
145 |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
146 err = ngx_errno; |
373
018569a8f09c
nginx-0.0.7-2004-06-30-19:30:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
361
diff
changeset
|
147 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
148 if (err == NGX_ENOENT) { |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
149 continue; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
150 } |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
151 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
152 ngx_log_error(NGX_LOG_ALERT, log, err, |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
153 "sysctlbyname(%s) failed", sysctls[i].name); |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
154 return NGX_ERROR; |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
155 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
156 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
157 ngx_ncpu = ngx_darwin_hw_ncpu; |
673 | 158 |
4226
003f0f341edf
Fixed range checking for the "somaxconn" sysctl.
Ruslan Ermilov <ru@nginx.com>
parents:
4223
diff
changeset
|
159 if (ngx_darwin_kern_ipc_somaxconn > 32767) { |
501 | 160 ngx_log_error(NGX_LOG_ALERT, log, 0, |
4226
003f0f341edf
Fixed range checking for the "somaxconn" sysctl.
Ruslan Ermilov <ru@nginx.com>
parents:
4223
diff
changeset
|
161 "sysctl kern.ipc.somaxconn must be less than 32768"); |
501 | 162 return NGX_ERROR; |
163 } | |
452 | 164 |
473 | 165 ngx_tcp_nodelay_and_tcp_nopush = 1; |
166 | |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
167 ngx_os_io = ngx_darwin_io; |
473 | 168 |
539 | 169 return NGX_OK; |
86
3973260705cc
nginx-0.0.1-2003-05-12-19:52:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
170 } |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
171 |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
172 |
539 | 173 void |
174 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
|
175 { |
673 | 176 u_long value; |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
177 ngx_uint_t i; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
178 |
2303
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
179 if (ngx_darwin_kern_ostype[0]) { |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
180 ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s", |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
181 ngx_darwin_kern_ostype, ngx_darwin_kern_osrelease); |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
182 } |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
183 |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
184 for (i = 0; sysctls[i].name; i++) { |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
185 if (sysctls[i].exists) { |
673 | 186 if (sysctls[i].size == sizeof(long)) { |
187 value = *(long *) sysctls[i].value; | |
188 | |
189 } else { | |
190 value = *(int *) sysctls[i].value; | |
191 } | |
192 | |
193 ngx_log_error(NGX_LOG_NOTICE, log, 0, "%s: %l", | |
194 sysctls[i].name, value); | |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
195 } |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
196 } |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
197 } |