Update and clean Tomato RAF files
[tomato.git] / release / src / router / nginx / src / os / unix / ngx_linux_init.c
blobb910380d7cea419c39dbb16079a47561993057d8
2 /*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Nginx, Inc.
5 */
8 #include <ngx_config.h>
9 #include <ngx_core.h>
12 u_char ngx_linux_kern_ostype[50];
13 u_char ngx_linux_kern_osrelease[50];
15 int ngx_linux_rtsig_max;
18 static ngx_os_io_t ngx_linux_io = {
19 ngx_unix_recv,
20 ngx_readv_chain,
21 ngx_udp_unix_recv,
22 ngx_unix_send,
23 #if (NGX_HAVE_SENDFILE)
24 ngx_linux_sendfile_chain,
25 NGX_IO_SENDFILE
26 #else
27 ngx_writev_chain,
29 #endif
33 ngx_int_t
34 ngx_os_specific_init(ngx_log_t *log)
36 struct utsname u;
38 if (uname(&u) == -1) {
39 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, "uname() failed");
40 return NGX_ERROR;
43 (void) ngx_cpystrn(ngx_linux_kern_ostype, (u_char *) u.sysname,
44 sizeof(ngx_linux_kern_ostype));
46 (void) ngx_cpystrn(ngx_linux_kern_osrelease, (u_char *) u.release,
47 sizeof(ngx_linux_kern_osrelease));
49 #if (NGX_HAVE_RTSIG)
51 int name[2];
52 size_t len;
53 ngx_err_t err;
55 name[0] = CTL_KERN;
56 name[1] = KERN_RTSIGMAX;
57 len = sizeof(ngx_linux_rtsig_max);
59 if (sysctl(name, 2, &ngx_linux_rtsig_max, &len, NULL, 0) == -1) {
60 err = ngx_errno;
62 if (err != NGX_ENOTDIR && err != NGX_ENOSYS) {
63 ngx_log_error(NGX_LOG_ALERT, log, err,
64 "sysctl(KERN_RTSIGMAX) failed");
66 return NGX_ERROR;
69 ngx_linux_rtsig_max = 0;
73 #endif
75 ngx_os_io = ngx_linux_io;
77 return NGX_OK;
81 void
82 ngx_os_specific_status(ngx_log_t *log)
84 ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
85 ngx_linux_kern_ostype, ngx_linux_kern_osrelease);
87 #if (NGX_HAVE_RTSIG)
88 ngx_log_error(NGX_LOG_NOTICE, log, 0, "sysctl(KERN_RTSIGMAX): %d",
89 ngx_linux_rtsig_max);
90 #endif