diff --git a/src/core/nginx.c b/src/core/nginx.c index 639c1cf082..5921c96006 100755 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -1551,7 +1551,7 @@ ngx_get_cpu_affinity(ngx_uint_t n) ngx_cpuset_t *mask; ngx_core_conf_t *ccf; -#if (T_NGX_HAVE_SCHED_GETAFFINITY) +#if (T_NGX_HAVE_SCHED_GETAFFINITY && NGX_HAVE_SC_NPROCESSORS_ONLN && NGX_HAVE_SC_NPROCESSORS_CONF) ngx_int_t worker_i, machine_core, all_machine_cores; #endif diff --git a/src/os/unix/ngx_getaffinity.h b/src/os/unix/ngx_getaffinity.h index e2c78dd9a5..18b0417970 100644 --- a/src/os/unix/ngx_getaffinity.h +++ b/src/os/unix/ngx_getaffinity.h @@ -3,21 +3,19 @@ * Copyright (C) lhanjian (lhjay1@gmail.com) */ -#ifndef _NGX_SETAFFINITY_H_INCLUDED_ -#define _NGX_SETAFFINITY_H_INCLUDED_ +#ifndef _NGX_GETAFFINITY_H_INCLUDED_ +#define _NGX_GETAFFINITY_H_INCLUDED_ -#if (NGX_HAVE_SCHED_SETAFFINITY) - -#define NGX_HAVE_CPU_AFFINITY 1 +#if (T_NGX_HAVE_SCHED_GETAFFINITY) typedef cpu_set_t ngx_cpuset_t; -void ngx_setaffinity(ngx_cpuset_t *cpu_affinity, ngx_log_t *log); +void ngx_getaffinity(ngx_cpuset_t *cpu_affinity, ngx_log_t *log); #else -#define ngx_setaffinity(cpu_affinity, log) +#define ngx_getaffinity(cpu_affinity, log) typedef uint64_t ngx_cpuset_t;