Projects
Browse Source     Search     Timeline     Wiki

Changeset 23299

Show
Ignore:
Timestamp:
07/10/07 13:24:39 (17 months ago)
Author:
zarzycki@…
Message:

<rdar://problem/5318461> Bug: launchd_core_logic.c:3739 (23294):8: (errno = task_set_special_port(mach_task_self(), which_port, ms->port)) == KERN_SUCCESS

Files:
1 modified

Legend:

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

    r23297 r23299  
    122122struct machservice { 
    123123        SLIST_ENTRY(machservice) sle; 
     124        SLIST_ENTRY(machservice) special_port_sle; 
    124125        LIST_ENTRY(machservice) name_hash_sle; 
    125126        LIST_ENTRY(machservice) port_hash_sle; 
     
    128129        unsigned int            gen_num; 
    129130        mach_port_name_t        port; 
    130         unsigned int            isActive:1, reset:1, recv:1, hide:1, kUNCServer:1, per_user_hack:1, debug_on_close:1, per_pid:1; 
     131        unsigned int            isActive:1, reset:1, recv:1, hide:1, kUNCServer:1, per_user_hack:1, debug_on_close:1, per_pid:1, special_port_num:10; 
    131132        const char              name[0]; 
    132133}; 
     134 
     135static SLIST_HEAD(, machservice) special_ports; /* hack, this should be per jobmgr_t */ 
    133136 
    134137#define PORT_HASH_SIZE 32 
     
    37413744                                break; 
    37423745                        default: 
    3743                                 job_assumes(ms->job, (errno = task_set_special_port(mach_task_self(), which_port, ms->port)) == KERN_SUCCESS); 
     3746                                ms->special_port_num = which_port; 
     3747                                SLIST_INSERT_HEAD(&special_ports, ms, special_port_sle); 
    37443748                                break; 
    37453749                        } 
     
    41864190        job_log(j, LOG_INFO, "Mach service deleted%s: %s", port_died ? " (port died)" : "", ms->name); 
    41874191 
     4192        if (ms->special_port_num) { 
     4193                SLIST_REMOVE(&special_ports, ms, machservice, special_port_sle); 
     4194        } 
     4195 
    41884196        SLIST_REMOVE(&j->machservices, ms, machservice, sle); 
    41894197        LIST_REMOVE(ms, name_hash_sle); 
     
    50235031job_mig_post_fork_ping(job_t j, task_t child_task) 
    50245032{ 
     5033        struct machservice *ms; 
     5034 
    50255035        if (!launchd_assumes(j != NULL)) { 
    50265036                return BOOTSTRAP_NO_MEMORY; 
     
    50305040 
    50315041        job_setup_exception_port(j, child_task); 
     5042 
     5043        SLIST_FOREACH(ms, &special_ports, special_port_sle) { 
     5044                if (j->per_user && (ms->special_port_num != TASK_ACCESS_PORT)) { 
     5045                        /* The TASK_ACCESS_PORT funny business is to workaround 5325399. */ 
     5046                        continue; 
     5047                } 
     5048                job_assumes(j, (errno = task_set_special_port(child_task, ms->special_port_num, ms->port)) == KERN_SUCCESS); 
     5049        } 
    50325050 
    50335051        job_assumes(j, launchd_mport_deallocate(child_task) == KERN_SUCCESS);