add getpgrp support in os mod

This commit is contained in:
mrmiywj committed 2020-05-08 01:10:12 -07:00
1 parent fef6eb46ff
commit a80d48be04
1 file changed
+6
+6
View File
@@ -1194,6 +1194,11 @@ fn os_getpgid(pid: u32, vm: &VirtualMachine) -> PyResult {
}
}
#[cfg(unix)]
fn os_getpgrp(vm: &VirtualMachine) -> PyResult {
Ok(vm.new_int(unistd::getpgrp().as_raw()))
}
#[cfg(all(unix, not(target_os = "redox")))]
fn os_getsid(pid: u32, vm: &VirtualMachine) -> PyResult {
match unistd::getsid(Some(Pid::from_raw(pid as i32))) {
@@ -1620,6 +1625,7 @@ fn extend_module_platform_specific(vm: &VirtualMachine, module: &PyObjectRef) {
"getegid" => ctx.new_function(os_getegid),
"getpgid" => ctx.new_function(os_getpgid),
"getuid" => ctx.new_function(os_getuid),
"getpgrp" => ctx.new_function(os_getpgrp),
"geteuid" => ctx.new_function(os_geteuid),
"pipe" => ctx.new_function(os_pipe), //TODO: windows
"set_blocking" => ctx.new_function(os_set_blocking),