Projects
Browse Source     Search     Timeline     Wiki

Changeset 23617

Show
Ignore:
Timestamp:
2008-05-02 15:58:06 (5 months ago)
Author:
zarzycki@…
Message:

<rdar://problem/5906374> launchd calls kill() on arm

Files:
1 modified

Legend:

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

    r23519 r23617  
    1919 */ 
    2020 
    21 #if defined(__LP64__) 
    22 /* ??? No way to get the old behavior */ 
    23 #define old_kill(x, y) kill(x, y) 
    24 #define old_killpg(x, y) kill(-(x), y) 
    25 #elif defined(__arm__) 
    26 /* ??? No blessed way to get the old behavior */ 
    27 extern int __kill(int, int, int); 
    28 #define old_kill(x, y) __kill(x, y, 0) 
    29 #define old_killpg(x, y) __kill(-(x), y, 0) 
    30 #else 
    31 #define _NONSTD_SOURCE 1 
    32 #define old_kill(x, y) kill(x, y) 
    33 #define old_killpg(x, y) killpg(x, y) 
    34 #endif 
     21#include <sys/syscall.h> 
     22#include <unistd.h> 
    3523#include <signal.h> 
    3624 
    3725#include "launchd_runtime_kill.h" 
    3826 
    39 /* 
    40  * POSIX defines consistency over correctness, and consequently kill/killpg now 
    41  * returns EPERM instead of ESRCH. 
    42  * 
    43  * I've filed 5487498 to get a non-portable kill() variant, but for now, 
    44  * defining _NONSTD_SOURCE gets us the old behavior. 
    45  */ 
    46  
    4727int 
    4828runtime_kill(pid_t pid, int sig) 
    4929{ 
    50         return old_kill(pid, sig); 
     30        /* 
     31         * POSIX defines consistency over correctness, and consequently 
     32         * kill/killpg now returns EPERM instead of ESRCH. 
     33         * 
     34         * I've filed 5487498 to get a non-portable kill(). 
     35         * We'll regretfully take advantage of implementation details for now. 
     36         */ 
     37        return syscall(SYS_kill, pid, sig, 0); 
    5138} 
    5239 
     
    5441runtime_killpg(pid_t pgrp, int sig) 
    5542{ 
    56         return old_killpg(pgrp, sig); 
     43        return runtime_kill(-pgrp, sig); 
    5744}