comparison src/os/unix/ngx_linux_init.c @ 42:41ccba1aba45 NGINX_0_1_21

nginx 0.1.21 *) Bugfix: the ngx_http_stub_status_module showed incorrect statistics if "rtsig" method was used or if several worker process ran on SMP. *) Bugfix: nginx could not be built by the icc compiler on Linux or if the zlib-1.2.x library was building from sources. *) Bugfix: nginx could not be built on NetBSD 2.0.
author Igor Sysoev <http://sysoev.ru>
date Tue, 22 Feb 2005 00:00:00 +0300
parents 6f8b0dc0f8dd
children b55cbf18157e
comparison
equal deleted inserted replaced
41:4d8e7a81b3a0 42:41ccba1aba45
26 0 26 0
27 #endif 27 #endif
28 }; 28 };
29 29
30 30
31 ngx_int_t ngx_os_init(ngx_log_t *log) 31 ngx_int_t
32 ngx_os_init(ngx_log_t *log)
32 { 33 {
33 int name[2]; 34 int name[2];
34 size_t len; 35 size_t len;
35 ngx_err_t err; 36 ngx_err_t err;
36 37
37 name[0] = CTL_KERN; 38 name[0] = CTL_KERN;
38 name[1] = KERN_OSTYPE; 39 name[1] = KERN_OSTYPE;
39 len = sizeof(ngx_linux_kern_ostype); 40 len = sizeof(ngx_linux_kern_ostype);
40 if (sysctl(name, sizeof(name), ngx_linux_kern_ostype, &len, NULL, 0) 41
41 == -1) { 42 if (sysctl(name, 2, ngx_linux_kern_ostype, &len, NULL, 0) == -1) {
42 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, 43 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
43 "sysctl(KERN_OSTYPE) failed"); 44 "sysctl(KERN_OSTYPE) failed");
44 return NGX_ERROR; 45 return NGX_ERROR;
45 } 46 }
46 47
47 name[0] = CTL_KERN; 48 /* name[0] = CTL_KERN; */
48 name[1] = KERN_OSRELEASE; 49 name[1] = KERN_OSRELEASE;
49 len = sizeof(ngx_linux_kern_osrelease); 50 len = sizeof(ngx_linux_kern_osrelease);
50 if (sysctl(name, sizeof(name), ngx_linux_kern_osrelease, &len, NULL, 0) 51
51 == -1) { 52 if (sysctl(name, 2, ngx_linux_kern_osrelease, &len, NULL, 0) == -1) {
52 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, 53 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
53 "sysctl(KERN_OSRELEASE) failed"); 54 "sysctl(KERN_OSRELEASE) failed");
54 return NGX_ERROR; 55 return NGX_ERROR;
55 } 56 }
56 57
57 58
58 name[0] = CTL_KERN; 59 /* name[0] = CTL_KERN; */
59 name[1] = KERN_RTSIGMAX; 60 name[1] = KERN_RTSIGMAX;
60 len = sizeof(ngx_linux_rtsig_max); 61 len = sizeof(ngx_linux_rtsig_max);
61 if (sysctl(name, sizeof(name), &ngx_linux_rtsig_max, &len, NULL, 0) == -1) { 62
63 if (sysctl(name, 2, &ngx_linux_rtsig_max, &len, NULL, 0) == -1) {
62 err = ngx_errno; 64 err = ngx_errno;
63 65
64 if (err != NGX_ENOTDIR) { 66 if (err != NGX_ENOTDIR) {
65 ngx_log_error(NGX_LOG_ALERT, log, err, 67 ngx_log_error(NGX_LOG_ALERT, log, err,
66 "sysctl(KERN_RTSIGMAX) failed"); 68 "sysctl(KERN_RTSIGMAX) failed");
76 78
77 return ngx_posix_init(log); 79 return ngx_posix_init(log);
78 } 80 }
79 81
80 82
81 void ngx_os_status(ngx_log_t *log) 83 void
84 ngx_os_status(ngx_log_t *log)
82 { 85 {
83 ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %s %s", 86 ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %s %s",
84 ngx_linux_kern_ostype, ngx_linux_kern_osrelease); 87 ngx_linux_kern_ostype, ngx_linux_kern_osrelease);
85 88
86 ngx_log_error(NGX_LOG_INFO, log, 0, "sysctl(KERN_RTSIGMAX): %d", 89 ngx_log_error(NGX_LOG_INFO, log, 0, "sysctl(KERN_RTSIGMAX): %d",