comparison src/os/unix/ngx_linux_init.c @ 0:f0b350454894 NGINX_0_1_0

nginx 0.1.0 *) The first public version.
author Igor Sysoev <http://sysoev.ru>
date Mon, 04 Oct 2004 00:00:00 +0400
parents
children cc9f381affaa
comparison
equal deleted inserted replaced
-1:000000000000 0:f0b350454894
1
2 /*
3 * Copyright (C) Igor Sysoev
4 */
5
6
7 #include <ngx_config.h>
8 #include <ngx_core.h>
9
10
11 char ngx_linux_kern_ostype[50];
12 char ngx_linux_kern_osrelease[20];
13
14 int ngx_linux_rtsig_max;
15
16
17 ngx_os_io_t ngx_os_io = {
18 ngx_unix_recv,
19 ngx_readv_chain,
20 ngx_unix_send,
21 #if (HAVE_SENDFILE)
22 ngx_linux_sendfile_chain,
23 NGX_IO_SENDFILE
24 #else
25 ngx_writev_chain,
26 0
27 #endif
28 };
29
30
31 ngx_int_t ngx_os_init(ngx_log_t *log)
32 {
33 int name[2], len;
34
35 name[0] = CTL_KERN;
36 name[1] = KERN_OSTYPE;
37 len = sizeof(ngx_linux_kern_ostype);
38 if (sysctl(name, sizeof(name), ngx_linux_kern_ostype, &len, NULL, 0)
39 == -1) {
40 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
41 "sysctl(KERN_OSTYPE) failed");
42 return NGX_ERROR;
43 }
44
45 name[0] = CTL_KERN;
46 name[1] = KERN_OSRELEASE;
47 len = sizeof(ngx_linux_kern_osrelease);
48 if (sysctl(name, sizeof(name), ngx_linux_kern_osrelease, &len, NULL, 0)
49 == -1) {
50 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
51 "sysctl(KERN_OSRELEASE) failed");
52 return NGX_ERROR;
53 }
54
55
56 name[0] = CTL_KERN;
57 name[1] = KERN_RTSIGMAX;
58 len = sizeof(ngx_linux_rtsig_max);
59 if (sysctl(name, sizeof(name), &ngx_linux_rtsig_max, &len, NULL, 0) == -1) {
60 ngx_log_error(NGX_LOG_INFO, log, ngx_errno,
61 "sysctl(KERN_RTSIGMAX) failed");
62 ngx_linux_rtsig_max = 0;
63
64 }
65
66
67 return ngx_posix_init(log);
68 }
69
70
71 void ngx_os_status(ngx_log_t *log)
72 {
73 ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %s %s",
74 ngx_linux_kern_ostype, ngx_linux_kern_osrelease);
75
76 ngx_log_error(NGX_LOG_INFO, log, 0, "sysctl(KERN_RTSIGMAX): %d",
77 ngx_linux_rtsig_max);
78
79 ngx_posix_status(log);
80 }