Mercurial > hg > nginx
comparison src/os/unix/ngx_process_cycle.c @ 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 | d3568507db51 |
children | d620f497c50f |
comparison
equal
deleted
inserted
replaced
4447:2b2d51cdbd97 | 4448:539355d9e675 |
---|---|
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 |