3 * Copyright (C) Igor Sysoev
7 #include <ngx_config.h>
11 char ngx_linux_kern_ostype
[50];
12 char ngx_linux_kern_osrelease
[20];
14 int ngx_linux_rtsig_max
;
17 ngx_os_io_t ngx_os_io
= {
22 ngx_linux_sendfile_chain
,
31 ngx_int_t
ngx_os_init(ngx_log_t
*log
)
37 name
[1] = KERN_OSTYPE
;
38 len
= sizeof(ngx_linux_kern_ostype
);
39 if (sysctl(name
, sizeof(name
), ngx_linux_kern_ostype
, &len
, NULL
, 0)
41 ngx_log_error(NGX_LOG_ALERT
, log
, ngx_errno
,
42 "sysctl(KERN_OSTYPE) failed");
47 name
[1] = KERN_OSRELEASE
;
48 len
= sizeof(ngx_linux_kern_osrelease
);
49 if (sysctl(name
, sizeof(name
), ngx_linux_kern_osrelease
, &len
, NULL
, 0)
51 ngx_log_error(NGX_LOG_ALERT
, log
, ngx_errno
,
52 "sysctl(KERN_OSRELEASE) failed");
58 name
[1] = KERN_RTSIGMAX
;
59 len
= sizeof(ngx_linux_rtsig_max
);
60 if (sysctl(name
, sizeof(name
), &ngx_linux_rtsig_max
, &len
, NULL
, 0) == -1) {
61 ngx_log_error(NGX_LOG_INFO
, log
, ngx_errno
,
62 "sysctl(KERN_RTSIGMAX) failed");
63 ngx_linux_rtsig_max
= 0;
67 ngx_init_setproctitle(log
);
70 return ngx_posix_init(log
);
74 void ngx_os_status(ngx_log_t
*log
)
76 ngx_log_error(NGX_LOG_INFO
, log
, 0, "OS: %s %s",
77 ngx_linux_kern_ostype
, ngx_linux_kern_osrelease
);
79 ngx_log_error(NGX_LOG_INFO
, log
, 0, "sysctl(KERN_RTSIGMAX): %d",
83 ngx_posix_status(log
);