Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ngx_linux_init.c
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) Igor Sysoev
4  * Copyright (C) Nginx, Inc.
5  */
6 
7 
8 #include <ngx_config.h>
9 #include <ngx_core.h>
10 
11 
14 
16 
17 
18 static ngx_os_io_t ngx_linux_io = {
23 #if (NGX_HAVE_SENDFILE)
26 #else
28  0
29 #endif
30 };
31 
32 
35 {
36  struct utsname u;
37 
38  if (uname(&u) == -1) {
39  ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, "uname() failed");
40  return NGX_ERROR;
41  }
42 
43  (void) ngx_cpystrn(ngx_linux_kern_ostype, (u_char *) u.sysname,
44  sizeof(ngx_linux_kern_ostype));
45 
46  (void) ngx_cpystrn(ngx_linux_kern_osrelease, (u_char *) u.release,
47  sizeof(ngx_linux_kern_osrelease));
48 
49 #if (NGX_HAVE_RTSIG)
50  {
51  int name[2];
52  size_t len;
53  ngx_err_t err;
54 
55  name[0] = CTL_KERN;
56  name[1] = KERN_RTSIGMAX;
57  len = sizeof(ngx_linux_rtsig_max);
58 
59  if (sysctl(name, 2, &ngx_linux_rtsig_max, &len, NULL, 0) == -1) {
60  err = ngx_errno;
61 
62  if (err != NGX_ENOTDIR && err != NGX_ENOSYS) {
63  ngx_log_error(NGX_LOG_ALERT, log, err,
64  "sysctl(KERN_RTSIGMAX) failed");
65 
66  return NGX_ERROR;
67  }
68 
70  }
71 
72  }
73 #endif
74 
75  ngx_os_io = ngx_linux_io;
76 
77  return NGX_OK;
78 }
79 
80 
81 void
83 {
84  ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
86 
87 #if (NGX_HAVE_RTSIG)
88  ngx_log_error(NGX_LOG_NOTICE, log, 0, "sysctl(KERN_RTSIGMAX): %d",
90 #endif
91 }