Klaus Demo nginx / a25d29f
the sysctl "kern.ostype" and "kern.osrelease" had appeared in MacOSX 10.5 only Igor Sysoev 13 years ago
1 changed file(s) with 33 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
6363 ngx_uint_t i;
6464
6565 size = sizeof(ngx_darwin_kern_ostype);
66 if (sysctlbyname("kern.ostype",
67 ngx_darwin_kern_ostype, &size, NULL, 0) == -1) {
68 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
69 "sysctlbyname(kern.ostype) failed");
66 if (sysctlbyname("kern.ostype", ngx_darwin_kern_ostype, &size, NULL, 0)
67 == -1)
68 {
69 err = ngx_errno;
7070
71 if (ngx_errno != NGX_ENOMEM) {
72 return NGX_ERROR;
71 if (err != NGX_ENOENT) {
72
73 ngx_log_error(NGX_LOG_ALERT, log, err,
74 "sysctlbyname(kern.ostype) failed");
75
76 if (err != NGX_ENOMEM) {
77 return NGX_ERROR;
78 }
79
80 ngx_darwin_kern_ostype[size - 1] = '\0';
7381 }
74
75 ngx_darwin_kern_ostype[size - 1] = '\0';
7682 }
7783
7884 size = sizeof(ngx_darwin_kern_osrelease);
79 if (sysctlbyname("kern.osrelease",
80 ngx_darwin_kern_osrelease, &size, NULL, 0) == -1) {
81 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
82 "sysctlbyname(kern.osrelease) failed");
85 if (sysctlbyname("kern.osrelease", ngx_darwin_kern_osrelease, &size,
86 NULL, 0)
87 == -1)
88 {
89 err = ngx_errno;
8390
84 if (ngx_errno != NGX_ENOMEM) {
85 return NGX_ERROR;
91 if (err != NGX_ENOENT) {
92
93 ngx_log_error(NGX_LOG_ALERT, log, err,
94 "sysctlbyname(kern.osrelease) failed");
95
96 if (err != NGX_ENOMEM) {
97 return NGX_ERROR;
98 }
99
100 ngx_darwin_kern_osrelease[size - 1] = '\0';
86101 }
87
88 ngx_darwin_kern_osrelease[size - 1] = '\0';
89102 }
90
91103
92104 for (i = 0; sysctls[i].name; i++) {
93105 size = sysctls[i].size;
135147 u_long value;
136148 ngx_uint_t i;
137149
138 ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
139 ngx_darwin_kern_ostype, ngx_darwin_kern_osrelease);
150 if (ngx_darwin_kern_ostype[0]) {
151 ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
152 ngx_darwin_kern_ostype, ngx_darwin_kern_osrelease);
153 }
140154
141155 for (i = 0; sysctls[i].name; i++) {
142156 if (sysctls[i].exists) {