comparison src/os/unix/ngx_process_cycle.c @ 5245:711fa02afae8

Valgrind: supressed complaints about uninitialized bytes. Valgrind complains if we pass uninitialized memory to a syscall: ==36492== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s) ==36492== at 0x6B5E6A: sendmsg (in /usr/lib/system/libsystem_kernel.dylib) ==36492== by 0x10004288E: ngx_signal_worker_processes (ngx_process_cycle.c:527) ==36492== by 0x1000417A7: ngx_master_process_cycle (ngx_process_cycle.c:203) ==36492== by 0x100001F10: main (nginx.c:410) ==36492== Address 0x7fff5fbff71c is on thread 1's stack Even initialization of all members of the structure passed isn't enough, as there is padding which still remains uninitialized and results in Valgrind complaint. Note there is no real problem here as data from uninitialized memory isn't used.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 05 Jun 2013 19:44:22 +0400
parents f941cf265cc5
children 7ecaa9e4bf1b
comparison
equal deleted inserted replaced
5244:593d344999f5 5245:711fa02afae8
353 ngx_int_t i; 353 ngx_int_t i;
354 ngx_channel_t ch; 354 ngx_channel_t ch;
355 355
356 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "start worker processes"); 356 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "start worker processes");
357 357
358 ngx_memzero(&ch, sizeof(ngx_channel_t));
359
358 ch.command = NGX_CMD_OPEN_CHANNEL; 360 ch.command = NGX_CMD_OPEN_CHANNEL;
359 361
360 for (i = 0; i < n; i++) { 362 for (i = 0; i < n; i++) {
361 363
362 ngx_spawn_process(cycle, ngx_worker_process_cycle, 364 ngx_spawn_process(cycle, ngx_worker_process_cycle,
398 } 400 }
399 401
400 ngx_spawn_process(cycle, ngx_cache_manager_process_cycle, 402 ngx_spawn_process(cycle, ngx_cache_manager_process_cycle,
401 &ngx_cache_manager_ctx, "cache manager process", 403 &ngx_cache_manager_ctx, "cache manager process",
402 respawn ? NGX_PROCESS_JUST_RESPAWN : NGX_PROCESS_RESPAWN); 404 respawn ? NGX_PROCESS_JUST_RESPAWN : NGX_PROCESS_RESPAWN);
405
406 ngx_memzero(&ch, sizeof(ngx_channel_t));
403 407
404 ch.command = NGX_CMD_OPEN_CHANNEL; 408 ch.command = NGX_CMD_OPEN_CHANNEL;
405 ch.pid = ngx_processes[ngx_process_slot].pid; 409 ch.pid = ngx_processes[ngx_process_slot].pid;
406 ch.slot = ngx_process_slot; 410 ch.slot = ngx_process_slot;
407 ch.fd = ngx_processes[ngx_process_slot].channel[0]; 411 ch.fd = ngx_processes[ngx_process_slot].channel[0];
457 ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo) 461 ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo)
458 { 462 {
459 ngx_int_t i; 463 ngx_int_t i;
460 ngx_err_t err; 464 ngx_err_t err;
461 ngx_channel_t ch; 465 ngx_channel_t ch;
466
467 ngx_memzero(&ch, sizeof(ngx_channel_t));
462 468
463 #if (NGX_BROKEN_SCM_RIGHTS) 469 #if (NGX_BROKEN_SCM_RIGHTS)
464 470
465 ch.command = 0; 471 ch.command = 0;
466 472
558 { 564 {
559 ngx_int_t i, n; 565 ngx_int_t i, n;
560 ngx_uint_t live; 566 ngx_uint_t live;
561 ngx_channel_t ch; 567 ngx_channel_t ch;
562 ngx_core_conf_t *ccf; 568 ngx_core_conf_t *ccf;
569
570 ngx_memzero(&ch, sizeof(ngx_channel_t));
563 571
564 ch.command = NGX_CMD_CLOSE_CHANNEL; 572 ch.command = NGX_CMD_CLOSE_CHANNEL;
565 ch.fd = -1; 573 ch.fd = -1;
566 574
567 live = 0; 575 live = 0;