fix extension
[nginx.git] / nginx / src / os / unix / ngx_solaris_init.c
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_solaris_sysname[20];
12 char ngx_solaris_release[10];
13 char ngx_solaris_version[50];
14
15
16 static ngx_os_io_t ngx_solaris_io = {
17     ngx_unix_recv,
18     ngx_readv_chain,
19     ngx_udp_unix_recv,
20     ngx_unix_send,
21 #if (NGX_HAVE_SENDFILE)
22     ngx_solaris_sendfilev_chain,
23     NGX_IO_SENDFILE
24 #else
25     ngx_writev_chain,
26     0
27 #endif
28 };
29
30
31 ngx_int_t
32 ngx_os_specific_init(ngx_log_t *log)
33 {
34     if (sysinfo(SI_SYSNAME, ngx_solaris_sysname, sizeof(ngx_solaris_sysname))
35         == -1)
36     {
37         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
38                       "sysinfo(SI_SYSNAME) failed");
39         return NGX_ERROR;
40     }
41
42     if (sysinfo(SI_RELEASE, ngx_solaris_release, sizeof(ngx_solaris_release))
43         == -1)
44     {
45         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
46                       "sysinfo(SI_RELEASE) failed");
47         return NGX_ERROR;
48     }
49
50     if (sysinfo(SI_VERSION, ngx_solaris_version, sizeof(ngx_solaris_version))
51         == -1)
52     {
53         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
54                       "sysinfo(SI_SYSNAME) failed");
55         return NGX_ERROR;
56     }
57
58
59     ngx_os_io = ngx_solaris_io;
60
61     return NGX_OK;
62 }
63
64
65 void
66 ngx_os_specific_status(ngx_log_t *log)
67 {
68
69     ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
70                   ngx_solaris_sysname, ngx_solaris_release);
71
72     ngx_log_error(NGX_LOG_NOTICE, log, 0, "version: %s",
73                   ngx_solaris_version);
74 }