Changeset 23299
- Timestamp:
- 07/10/07 13:24:39 (17 months ago)
- Files:
-
- 1 modified
-
trunk/launchd/src/launchd_core_logic.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/launchd/src/launchd_core_logic.c
r23297 r23299 122 122 struct machservice { 123 123 SLIST_ENTRY(machservice) sle; 124 SLIST_ENTRY(machservice) special_port_sle; 124 125 LIST_ENTRY(machservice) name_hash_sle; 125 126 LIST_ENTRY(machservice) port_hash_sle; … … 128 129 unsigned int gen_num; 129 130 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; 131 132 const char name[0]; 132 133 }; 134 135 static SLIST_HEAD(, machservice) special_ports; /* hack, this should be per jobmgr_t */ 133 136 134 137 #define PORT_HASH_SIZE 32 … … 3741 3744 break; 3742 3745 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); 3744 3748 break; 3745 3749 } … … 4186 4190 job_log(j, LOG_INFO, "Mach service deleted%s: %s", port_died ? " (port died)" : "", ms->name); 4187 4191 4192 if (ms->special_port_num) { 4193 SLIST_REMOVE(&special_ports, ms, machservice, special_port_sle); 4194 } 4195 4188 4196 SLIST_REMOVE(&j->machservices, ms, machservice, sle); 4189 4197 LIST_REMOVE(ms, name_hash_sle); … … 5023 5031 job_mig_post_fork_ping(job_t j, task_t child_task) 5024 5032 { 5033 struct machservice *ms; 5034 5025 5035 if (!launchd_assumes(j != NULL)) { 5026 5036 return BOOTSTRAP_NO_MEMORY; … … 5030 5040 5031 5041 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 } 5032 5050 5033 5051 job_assumes(j, launchd_mport_deallocate(child_task) == KERN_SUCCESS);

