Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.15.11 ]​[ nginx-1.14.2 ]​

0001 
0002 /*
0003  * Copyright (C) Igor Sysoev
0004  * Copyright (C) Nginx, Inc.
0005  */
0006 
0007 
0008 #include <ngx_config.h>
0009 #include <ngx_core.h>
0010 
0011 
0012 u_char  ngx_linux_kern_ostype[50];
0013 u_char  ngx_linux_kern_osrelease[50];
0014 
0015 
0016 static ngx_os_io_t ngx_linux_io = {
0017     ngx_unix_recv,
0018     ngx_readv_chain,
0019     ngx_udp_unix_recv,
0020     ngx_unix_send,
0021     ngx_udp_unix_send,
0022     ngx_udp_unix_sendmsg_chain,
0023 #if (NGX_HAVE_SENDFILE)
0024     ngx_linux_sendfile_chain,
0025     NGX_IO_SENDFILE
0026 #else
0027     ngx_writev_chain,
0028     0
0029 #endif
0030 };
0031 
0032 
0033 ngx_int_t
0034 ngx_os_specific_init(ngx_log_t *log)
0035 {
0036     struct utsname  u;
0037 
0038     if (uname(&u) == -1) {
0039         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, "uname() failed");
0040         return NGX_ERROR;
0041     }
0042 
0043     (void) ngx_cpystrn(ngx_linux_kern_ostype, (u_char *) u.sysname,
0044                        sizeof(ngx_linux_kern_ostype));
0045 
0046     (void) ngx_cpystrn(ngx_linux_kern_osrelease, (u_char *) u.release,
0047                        sizeof(ngx_linux_kern_osrelease));
0048 
0049     ngx_os_io = ngx_linux_io;
0050 
0051     return NGX_OK;
0052 }
0053 
0054 
0055 void
0056 ngx_os_specific_status(ngx_log_t *log)
0057 {
0058     ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
0059                   ngx_linux_kern_ostype, ngx_linux_kern_osrelease);
0060 }