mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
Fixed sched_setaffinity(2) to correctly pass size.
Second argument (cpusetsize) is size in bytes, not in bits. Previously used constant 32 resulted in reading of uninitialized memory and caused EINVAL to be returned on some Linux kernels.
This commit is contained in:
parent
9572920af0
commit
b904676b5e
@ -914,7 +914,10 @@ ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority)
|
|||||||
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
|
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
|
||||||
"sched_setaffinity(0x%08Xl)", cpu_affinity);
|
"sched_setaffinity(0x%08Xl)", cpu_affinity);
|
||||||
|
|
||||||
if (sched_setaffinity(0, 32, (cpu_set_t *) &cpu_affinity) == -1) {
|
if (sched_setaffinity(0, sizeof(cpu_affinity),
|
||||||
|
(cpu_set_t *) &cpu_affinity)
|
||||||
|
== -1)
|
||||||
|
{
|
||||||
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
||||||
"sched_setaffinity(0x%08Xl) failed", cpu_affinity);
|
"sched_setaffinity(0x%08Xl) failed", cpu_affinity);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user