Changeset 23602
- Timestamp:
- 2008-04-21 14:41:09 (6 months ago)
- Location:
- trunk/launchd/src
- Files:
-
- 4 modified
-
launchd_core_logic.c (modified) (2 diffs)
-
liblaunch_private.h (modified) (1 diff)
-
libvproc.c (modified) (1 diff)
-
libvproc_private.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/launchd/src/launchd_core_logic.c
r23601 r23602 702 702 } 703 703 704 if (j->kill_via_shmem && (tmp = launch_data_new_bool(true))) { 705 uint32_t tmp_cnt = -1; 706 707 launch_data_dict_insert(r, tmp, LAUNCH_JOBKEY_ENABLETRANSACTIONS); 708 709 if (j->shmem) { 710 tmp_cnt = j->shmem->vp_shmem_transaction_cnt; 711 } 712 713 if (j->sent_kill_via_shmem) { 714 tmp_cnt++; 715 } 716 717 if ((tmp = launch_data_new_integer(tmp_cnt))) { 718 launch_data_dict_insert(r, tmp, LAUNCH_JOBKEY_TRANSACTIONCOUNT); 719 } 720 } 721 704 722 if (j->session_create && (tmp = launch_data_new_bool(true))) { 705 723 launch_data_dict_insert(r, tmp, LAUNCH_JOBKEY_SESSIONCREATE); … … 5709 5727 return 0; 5710 5728 } 5729 } else if (sig == VPROC_MAGIC_TRYKILL_SIGNAL) { 5730 if (!j->kill_via_shmem) { 5731 return BOOTSTRAP_NOT_PRIVILEGED; 5732 } 5733 5734 if (!j->shmem) { 5735 j->sent_kill_via_shmem = true; 5736 job_assumes(j, runtime_kill(otherj->p, SIGKILL) != -1); 5737 return 0; 5738 } 5739 5740 if (__sync_bool_compare_and_swap(&j->shmem->vp_shmem_transaction_cnt, 0, -1)) { 5741 j->shmem->vp_shmem_flags |= VPROC_SHMEM_EXITING; 5742 j->sent_kill_via_shmem = true; 5743 job_assumes(j, runtime_kill(otherj->p, SIGKILL) != -1); 5744 return 0; 5745 } 5746 5747 return BOOTSTRAP_NOT_PRIVILEGED; 5711 5748 } else if (otherj->p) { 5712 5749 job_assumes(j, runtime_kill(otherj->p, sig) != -1); -
trunk/launchd/src/liblaunch_private.h
r23503 r23602 47 47 #define LAUNCH_KEY_BATCHQUERY "BatchQuery" 48 48 49 #define LAUNCH_JOBKEY_TRANSACTIONCOUNT "TransactionCount" 49 50 #define LAUNCH_JOBKEY_QUARANTINEDATA "QuarantineData" 50 51 #define LAUNCH_JOBKEY_SANDBOXPROFILE "SandboxProfile" -
trunk/launchd/src/libvproc.c
r23580 r23602 133 133 _vproc_transaction_try_exit(int status) 134 134 { 135 typeof(vproc_shmem->vp_shmem_transaction_cnt) newval;136 137 135 if (unlikely(vproc_shmem == NULL)) { 138 136 return; 139 137 } 140 138 141 vproc_shmem->vp_shmem_flags |= VPROC_SHMEM_EXITING; 142 143 newval = __sync_sub_and_fetch(&vproc_shmem->vp_shmem_transaction_cnt, 1); 144 145 if (newval < 0) { 139 if (__sync_bool_compare_and_swap(&vproc_shmem->vp_shmem_transaction_cnt, 0, -1)) { 140 vproc_shmem->vp_shmem_flags |= VPROC_SHMEM_EXITING; 146 141 _exit(status); 147 142 } -
trunk/launchd/src/libvproc_private.h
r23590 r23602 32 32 #pragma GCC visibility push(default) 33 33 34 /* DO NOT use this. This is a hack for launchctl */ 35 #define VPROC_MAGIC_UNLOAD_SIGNAL 0x4141504C 34 /* DO NOT use this. This is a hack for 'launchctl' */ 35 #define VPROC_MAGIC_UNLOAD_SIGNAL 0x4141504C 36 /* DO NOT use this. This is a hack for 'loginwindow' */ 37 #define VPROC_MAGIC_TRYKILL_SIGNAL 0x6161706C 36 38 37 39 typedef enum {

