Mercurial > hg > nginx
annotate src/os/unix/ngx_darwin_init.c @ 8945:e72db9162180 quic
QUIC: got rid of excessive "qsock" argument in ngx_quic_output.c.
The output is always sent to the active path, which is stored in the
quic connection. There is no need to pass it in arguments.
When output has to be send to to a specific path (in rare cases, such as
path probing), a separate method exists (ngx_quic_frame_sendto()).
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Mon, 27 Dec 2021 13:52:57 +0300 |
parents | 56fc55e32f23 |
children |
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, |
6692 | 27 ngx_udp_unix_sendmsg_chain, |
469 | 28 #if (NGX_HAVE_SENDFILE) |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
29 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
|
30 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
|
31 #else |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
32 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
|
33 0 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
34 #endif |
91
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 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
37 |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
38 typedef struct { |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
39 char *name; |
673 | 40 void *value; |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
41 size_t size; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
42 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
|
43 } sysctl_t; |
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 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
46 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
|
47 { "hw.ncpu", |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
48 &ngx_darwin_hw_ncpu, |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
49 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
|
50 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
51 { "net.inet.tcp.sendspace", |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
52 &ngx_darwin_net_inet_tcp_sendspace, |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
53 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
|
54 |
501 | 55 { "kern.ipc.somaxconn", |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
56 &ngx_darwin_kern_ipc_somaxconn, |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
57 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
|
58 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
59 { 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
|
60 }; |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
61 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
62 |
4223
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
63 void |
5225
15a7deeaa19a
Use "void" for functions with empty parameter list.
Sergey Kandaurov <pluknet@nginx.com>
parents:
4412
diff
changeset
|
64 ngx_debug_init(void) |
4223
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
65 { |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
66 #if (NGX_DEBUG_MALLOC) |
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 /* |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
69 * 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
|
70 * and fills allocated memory with 0xAA. |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
71 * 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
|
72 * MallocPreScribble fills allocated memory with 0xAA. |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
73 * MacOSX 10.3: MallocScribble fills freed memory with 0x55, |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
74 * and no way to fill allocated memory. |
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 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
77 setenv("MallocScribble", "1", 0); |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
78 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
79 ngx_debug_malloc = 1; |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
80 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
81 #else |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
82 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
83 if (getenv("MallocScribble")) { |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
84 ngx_debug_malloc = 1; |
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 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
87 #endif |
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 |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
2303
diff
changeset
|
90 |
539 | 91 ngx_int_t |
92 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
|
93 { |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
94 size_t size; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
95 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
|
96 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
|
97 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
98 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
|
99 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
|
100 == -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
|
101 { |
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 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
|
103 |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
104 if (err != NGX_ENOENT) { |
461 | 105 |
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
|
106 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
|
107 "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
|
108 |
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 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
|
110 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
|
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 |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
113 ngx_darwin_kern_ostype[size - 1] = '\0'; |
461 | 114 } |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
115 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
116 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 == -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
|
121 { |
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 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
|
123 |
22b05d177dc6
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
124 if (err != NGX_ENOENT) { |
461 | 125 |
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
|
126 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
|
127 "sysctlbyname(kern.osrelease) failed"); |
461 | 128 |
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
|
129 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
|
130 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
|
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 |
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 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
|
134 } |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
135 } |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
136 |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
137 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
|
138 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
|
139 |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
140 if (sysctlbyname(sysctls[i].name, sysctls[i].value, &size, NULL, 0) |
673 | 141 == 0) |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
142 { |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
143 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
|
144 continue; |
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 |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
147 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
|
148 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
149 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
|
150 continue; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
151 } |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
152 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
153 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
|
154 "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
|
155 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
|
156 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
157 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
158 ngx_ncpu = ngx_darwin_hw_ncpu; |
673 | 159 |
4226
003f0f341edf
Fixed range checking for the "somaxconn" sysctl.
Ruslan Ermilov <ru@nginx.com>
parents:
4223
diff
changeset
|
160 if (ngx_darwin_kern_ipc_somaxconn > 32767) { |
501 | 161 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
|
162 "sysctl kern.ipc.somaxconn must be less than 32768"); |
501 | 163 return NGX_ERROR; |
164 } | |
452 | 165 |
473 | 166 ngx_tcp_nodelay_and_tcp_nopush = 1; |
167 | |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
1771
diff
changeset
|
168 ngx_os_io = ngx_darwin_io; |
473 | 169 |
539 | 170 return NGX_OK; |
86
3973260705cc
nginx-0.0.1-2003-05-12-19:52:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
171 } |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
172 |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
173 |
539 | 174 void |
175 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
|
176 { |
673 | 177 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
|
178 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
|
179 |
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
|
180 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
|
181 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
|
182 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
|
183 } |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
184 |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
185 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
|
186 if (sysctls[i].exists) { |
673 | 187 if (sysctls[i].size == sizeof(long)) { |
188 value = *(long *) sysctls[i].value; | |
189 | |
190 } else { | |
191 value = *(int *) sysctls[i].value; | |
192 } | |
193 | |
194 ngx_log_error(NGX_LOG_NOTICE, log, 0, "%s: %l", | |
195 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
|
196 } |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
197 } |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
198 } |