Mercurial > hg > nginx-quic
changeset 4448:539355d9e675 stable-1.0
Merge of r4404:
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 05 Feb 2012 19:25:24 +0000 |
parents | 2b2d51cdbd97 |
children | b80b278fe470 |
files | src/os/unix/ngx_process_cycle.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os/unix/ngx_process_cycle.c +++ b/src/os/unix/ngx_process_cycle.c @@ -914,7 +914,10 @@ ngx_worker_process_init(ngx_cycle_t *cyc ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "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, "sched_setaffinity(0x%08Xl) failed", cpu_affinity); }