aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_posix_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/unix/ngx_posix_init.c')
-rw-r--r--src/os/unix/ngx_posix_init.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c
index 02642bd7c..eea65a903 100644
--- a/src/os/unix/ngx_posix_init.c
+++ b/src/os/unix/ngx_posix_init.c
@@ -47,7 +47,13 @@ ngx_os_init(ngx_log_t *log)
for (n = ngx_pagesize; n >>= 1; ngx_pagesize_shift++) { /* void */ }
+#if (NGX_HAVE_SC_NPROCESSORS_ONLN)
if (ngx_ncpu == 0) {
+ ngx_ncpu = sysconf(_SC_NPROCESSORS_ONLN);
+ }
+#endif
+
+ if (ngx_ncpu < 1) {
ngx_ncpu = 1;
}