Klaus Demo nginx / b904676
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. Maxim Dounin 10 years ago
1 changed file(s) with 4 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
913913 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
914914 "sched_setaffinity(0x%08Xl)", cpu_affinity);
915915
916 if (sched_setaffinity(0, 32, (cpu_set_t *) &cpu_affinity) == -1) {
916 if (sched_setaffinity(0, sizeof(cpu_affinity),
917 (cpu_set_t *) &cpu_affinity)
918 == -1)
919 {
917920 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
918921 "sched_setaffinity(0x%08Xl) failed", cpu_affinity);
919922 }