diff --git a/src/call.rs b/src/call.rs index 623eae4..212338a 100644 --- a/src/call.rs +++ b/src/call.rs @@ -172,6 +172,11 @@ pub fn getpid() -> Result { unsafe { syscall0(SYS_GETPID) } } +/// Get the process group ID +pub fn getpgid(pid: usize) -> Result { + unsafe { syscall1(SYS_GETPGID, pid) } +} + /// Get the parent process ID pub fn getppid() -> Result { unsafe { syscall0(SYS_GETPPID) } @@ -252,6 +257,11 @@ pub fn rmdir>(path: T) -> Result { 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 { + unsafe { syscall2(SYS_SETPGID, pid, pgid) } +} + /// Set the current process group IDs pub fn setregid(rgid: usize, egid: usize) -> Result { unsafe { syscall2(SYS_SETREGID, rgid, egid) } diff --git a/src/number.rs b/src/number.rs index f2570a1..e240c7a 100644 --- a/src/number.rs +++ b/src/number.rs @@ -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;