Merge pull request #108 from mmstick/kill
Implement kill() and killpg()
This commit is contained in:
@@ -115,6 +115,14 @@ pub fn getuid() -> uid_t {
|
||||
e(unsafe { syscall!(GETUID) })
|
||||
}
|
||||
|
||||
pub fn kill(pid: pid_t, sig: c_int) -> c_int {
|
||||
e(unsafe { syscall!(KILL, pid, sig) }) as c_int
|
||||
}
|
||||
|
||||
pub fn killpg(pgrp: pid_t, sig: c_int) -> c_int {
|
||||
e(unsafe { syscall!(KILL, -(pgrp as isize) as pid_t, sig) }) as c_int
|
||||
}
|
||||
|
||||
pub fn link(path1: *const c_char, path2: *const c_char) -> c_int {
|
||||
e(unsafe { syscall!(LINKAT, AT_FDCWD, path1, AT_FDCWD, path2, 0) }) as c_int
|
||||
}
|
||||
|
||||
@@ -119,6 +119,14 @@ pub fn getuid() -> uid_t {
|
||||
e(syscall::getuid()) as pid_t
|
||||
}
|
||||
|
||||
pub fn kill(pid: pid_t, sig: c_int) -> c_int {
|
||||
e(syscall::kill(pid, sig as usize)) as c_int
|
||||
}
|
||||
|
||||
pub fn killpg(pgrp: pid_t, sig: c_int) -> c_int {
|
||||
e(syscall::kill(-(pgrp as isize) as pid_t, sig as usize)) as c_int
|
||||
}
|
||||
|
||||
pub fn link(path1: *const c_char, path2: *const c_char) -> c_int {
|
||||
let path1 = unsafe { c_str(path1) };
|
||||
let path2 = unsafe { c_str(path2) };
|
||||
|
||||
@@ -27,12 +27,12 @@ pub type sigset_t = sys_sigset_t;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn kill(pid: pid_t, sig: c_int) -> c_int {
|
||||
unimplemented!();
|
||||
platform::kill(pid, sig)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn killpg(pgrp: pid_t, sig: c_int) -> c_int {
|
||||
unimplemented!();
|
||||
platform::killpg(pgrp, sig)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
Reference in New Issue
Block a user