Add getpgid, setpgid

This commit is contained in:
Jeremy Soller
2017-07-23 14:44:17 -06:00
parent 8e05a199d9
commit 4db8f75a65
2 changed files with 12 additions and 0 deletions

View File

@@ -172,6 +172,11 @@ pub fn getpid() -> Result<usize> {
unsafe { syscall0(SYS_GETPID) }
}
/// Get the process group ID
pub fn getpgid(pid: usize) -> Result<usize> {
unsafe { syscall1(SYS_GETPGID, pid) }
}
/// Get the parent process ID
pub fn getppid() -> Result<usize> {
unsafe { syscall0(SYS_GETPPID) }
@@ -252,6 +257,11 @@ pub fn rmdir<T: AsRef<[u8]>>(path: T) -> Result<usize> {
unsafe { syscall2(SYS_RMDIR, path.as_ref().as_ptr() as usize, path.as_ref().len()) }
}
/// Set the process group ID
pub fn setpgid(pid: usize, pgid: usize) -> Result<usize> {
unsafe { syscall2(SYS_SETPGID, pid, pgid) }
}
/// Set the current process group IDs
pub fn setregid(rgid: usize, egid: usize) -> Result<usize> {
unsafe { syscall2(SYS_SETREGID, rgid, egid) }

View File

@@ -47,6 +47,7 @@ pub const SYS_GETEUID: usize = 201;
pub const SYS_GETGID: usize = 200;
pub const SYS_GETNS: usize = 950;
pub const SYS_GETPID: usize = 20;
pub const SYS_GETPGID: usize = 132;
pub const SYS_GETPPID: usize = 64;
pub const SYS_GETUID: usize = 199;
pub const SYS_IOPL: usize = 110;
@@ -59,6 +60,7 @@ pub const SYS_PHYSMAP: usize = 947;
pub const SYS_PHYSUNMAP: usize =948;
pub const SYS_VIRTTOPHYS: usize=949;
pub const SYS_PIPE2: usize = 331;
pub const SYS_SETPGID: usize = 57;
pub const SYS_SETREGID: usize = 204;
pub const SYS_SETRENS: usize = 952;
pub const SYS_SETREUID: usize = 203;