1
2 /*
3 * Copyright (C) Igor Sysoev
4 */
5
6
7 #include <ngx_config.h>
8 #include <ngx_core.h>
9
10
11 u_char ngx_linux_kern_ostype[50];
12 u_char ngx_linux_kern_osrelease[50];
13
14 int ngx_linux_rtsig_max;
15
16
17 static ngx_os_io_t ngx_linux_io = {
18 ngx_unix_recv,
19 ngx_readv_chain,
20 ngx_udp_unix_recv,
21 ngx_unix_send,
22 #if (NGX_HAVE_SENDFILE)
23 ngx_linux_sendfile_chain,
24 NGX_IO_SENDFILE
25 #else
26 ngx_writev_chain,
27 0
28 #endif
29 };
30
31
32 ngx_int_t
33 ngx_os_specific_init(ngx_log_t *log)
34 {
35 struct utsname u;
36
37 if (uname(&u) == -1) {
38 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, "uname() failed");
39 return NGX_ERROR;
40 }
41
42 (void) ngx_cpystrn(ngx_linux_kern_ostype, (u_char *) u.sysname,
43 sizeof(ngx_linux_kern_ostype));
44
45 (void) ngx_cpystrn(ngx_linux_kern_osrelease, (u_char *) u.release,
46 sizeof(ngx_linux_kern_osrelease));
47
48 #if (NGX_HAVE_RTSIG)
49 {
50 int name[2];
51 size_t len;
52 ngx_err_t err;
53
54 name[0] = CTL_KERN;
55 name[1] = KERN_RTSIGMAX;
56 len = sizeof(ngx_linux_rtsig_max);
57
58 if (sysctl(name, 2, &ngx_linux_rtsig_max, &len, NULL, 0) == -1) {
59 err = ngx_errno;
60
61 if (err != NGX_ENOTDIR && err != NGX_ENOSYS) {
62 ngx_log_error(NGX_LOG_ALERT, log, err,
63 "sysctl(KERN_RTSIGMAX) failed");
64
65 return NGX_ERROR;
66 }
67
68 ngx_linux_rtsig_max = 0;
69 }
70
71 }
72 #endif
73
74 ngx_os_io = ngx_linux_io;
75
76 return NGX_OK;
77 }
78
79
80 void
81 ngx_os_specific_status(ngx_log_t *log)
82 {
83 ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
84 ngx_linux_kern_ostype, ngx_linux_kern_osrelease);
85
86 #if (NGX_HAVE_RTSIG)
87 ngx_log_error(NGX_LOG_NOTICE, log, 0, "sysctl(KERN_RTSIGMAX): %d",
88 ngx_linux_rtsig_max);
89 #endif
90 }
91
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.