Mercurial > hg > nginx
comparison src/os/unix/ngx_process_cycle.c @ 4403:c8b9f62cb414
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 | Mon, 16 Jan 2012 11:13:48 +0000 |
parents | 59b99f217c6d |
children | d620f497c50f |
comparison
equal
deleted
inserted
replaced
4402:b20019ecfdcc | 4403:c8b9f62cb414 |
---|---|
912 | 912 |
913 if (cpu_affinity) { | 913 if (cpu_affinity) { |
914 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, | 914 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, |
915 "sched_setaffinity(0x%08Xl)", cpu_affinity); | 915 "sched_setaffinity(0x%08Xl)", cpu_affinity); |
916 | 916 |
917 if (sched_setaffinity(0, 32, (cpu_set_t *) &cpu_affinity) == -1) { | 917 if (sched_setaffinity(0, sizeof(cpu_affinity), |
918 (cpu_set_t *) &cpu_affinity) | |
919 == -1) | |
920 { | |
918 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | 921 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
919 "sched_setaffinity(0x%08Xl) failed", cpu_affinity); | 922 "sched_setaffinity(0x%08Xl) failed", cpu_affinity); |
920 } | 923 } |
921 } | 924 } |
922 | 925 |