File tree 1 file changed +20
-0
lines changed 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1457,6 +1457,25 @@ fn os_sync(_vm: &VirtualMachine) -> PyResult<()> {
1457
1457
Ok ( ( ) )
1458
1458
}
1459
1459
1460
+ // cfg from nix
1461
+ #[ cfg( any(
1462
+ target_os = "android" ,
1463
+ target_os = "freebsd" ,
1464
+ target_os = "linux" ,
1465
+ target_os = "openbsd"
1466
+ ) ) ]
1467
+ fn os_getresuid ( vm : & VirtualMachine ) -> PyResult < ( u32 , u32 , u32 ) > {
1468
+ let mut ruid = 0 ;
1469
+ let mut euid = 0 ;
1470
+ let mut suid = 0 ;
1471
+ let ret = unsafe { libc:: getresuid ( & mut ruid, & mut euid, & mut suid) } ;
1472
+ if ret == 0 {
1473
+ Ok ( ( ruid, euid, suid) )
1474
+ } else {
1475
+ Err ( errno_err ( vm) )
1476
+ }
1477
+ }
1478
+
1460
1479
pub fn make_module ( vm : & VirtualMachine ) -> PyObjectRef {
1461
1480
let ctx = & vm. ctx ;
1462
1481
@@ -1688,6 +1707,7 @@ fn extend_module_platform_specific(vm: &VirtualMachine, module: &PyObjectRef) {
1688
1707
) ) ]
1689
1708
extend_module ! ( vm, module, {
1690
1709
"setresuid" => ctx. new_function( os_setresuid) ,
1710
+ "getresuid" => ctx. new_function( os_getresuid) ,
1691
1711
} ) ;
1692
1712
1693
1713
// cfg taken from nix
You can’t perform that action at this time.
0 commit comments