Projects
Browse Source     Search     Timeline     Wiki

Changeset 23615

Show
Ignore:
Timestamp:
2008-05-02 15:53:47 (4 months ago)
Author:
zarzycki@…
Message:

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/SULeopard/launchd/src/launchd_runtime_kill.c

    r23492 r23615  
    1919 */ 
    2020 
    21 #if !defined(__LP64__) && !defined(__arm__) 
    22 #define _NONSTD_SOURCE 1 
    23 #define old_kill(x, y) kill(x, y) 
    24 #define old_killpg(x, y) killpg(x, y) 
    25 #else 
    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 #endif 
     21#include <sys/syscall.h> 
     22#include <unistd.h> 
    3123#include <signal.h> 
    3224 
    3325#include "launchd_runtime_kill.h" 
    3426 
    35 /* 
    36  * POSIX defines consistency over correctness, and consequently kill/killpg now 
    37  * returns EPERM instead of ESRCH. 
    38  * 
    39  * I've filed 5487498 to get a non-portable kill() variant, but for now, 
    40  * defining _NONSTD_SOURCE gets us the old behavior. 
    41  */ 
    42  
    4327int 
    4428runtime_kill(pid_t pid, int sig) 
    4529{ 
    46         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); 
    4738} 
    4839 
     
    5041runtime_killpg(pid_t pgrp, int sig) 
    5142{ 
    52         return old_killpg(pgrp, sig); 
     43        return runtime_kill(-pgrp, sig); 
    5344}