Projects
Browse Source     Search     Timeline     Wiki

Changeset 23577

Show
Ignore:
Timestamp:
2008-03-27 14:57:51 (5 months ago)
Author:
zarzycki@…
Message:

Refinements.

Location:
trunk/launchd/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/launchd/src/launchd_core_logic.c

    r23576 r23577  
    22322232        if (j->shmem) { 
    22332233                job_assumes(j, munmap(j->shmem, getpagesize()) == 0); 
     2234                j->shmem = NULL; 
    22342235        } 
    22352236 
     
    54475448        } 
    54485449 
     5450        if (unlikely(j->shmem)) { 
     5451                job_log(j, LOG_ERR, "Tried to setup shared memory more than once"); 
     5452                return BOOTSTRAP_NOT_PRIVILEGED; 
     5453        } 
     5454 
    54495455        size_of_page_orig = size_of_page = getpagesize(); 
    54505456 
  • trunk/launchd/src/libvproc.c

    r23574 r23577  
    5555static int64_t cached_pid = -1; 
    5656static struct vproc_shmem_s *vproc_shmem; 
     57static pthread_once_t shmem_inited = PTHREAD_ONCE_INIT; 
    5758 
    5859static void 
     
    9596 
    9697        if (unlikely(vproc_shmem == NULL)) { 
    97                 vproc_shmem_init(); 
    98                 if (vproc_shmem == NULL) { 
     98                int po_r = pthread_once(&shmem_inited, vproc_shmem_init); 
     99                if (po_r != 0 || vproc_shmem == NULL) { 
    99100                        return; 
    100101                } 
     
    148149 
    149150        if (unlikely(vproc_shmem == NULL)) { 
    150                 vproc_shmem_init(); 
    151                 if (vproc_shmem == NULL) { 
     151                int po_r = pthread_once(&shmem_inited, vproc_shmem_init); 
     152                if (po_r != 0 || vproc_shmem == NULL) { 
    152153                        return NULL; 
    153154                }