@@ -15,9 +15,13 @@ use void::Void;
15
15
use sys:: stat:: Mode ;
16
16
use std:: fmt;
17
17
18
- #[ cfg( any( target_os = "linux " , target_os = "android " ) ) ]
18
+ #[ cfg( any( target_os = "android " , target_os = "linux " ) ) ]
19
19
pub use self :: linux:: * ;
20
20
21
+ #[ cfg( any( target_os = "android" , target_os = "freebsd" ,
22
+ target_os = "linux" , target_os = "openbsd" ) ) ]
23
+ pub use self :: setres:: * ;
24
+
21
25
/// User identifier
22
26
///
23
27
/// Newtype pattern around `uid_t` (which is just alias). It prevents bugs caused by accidentally
@@ -1601,12 +1605,10 @@ pub fn sysconf(var: SysconfVar) -> Result<Option<c_long>> {
1601
1605
}
1602
1606
}
1603
1607
1604
- #[ cfg( any( target_os = "linux " , target_os = "android " ) ) ]
1608
+ #[ cfg( any( target_os = "android " , target_os = "linux " ) ) ]
1605
1609
mod linux {
1606
- use libc;
1607
1610
use sys:: syscall:: { syscall, SYSPIVOTROOT } ;
1608
1611
use { Errno , Result , NixPath } ;
1609
- use super :: { Uid , Gid } ;
1610
1612
1611
1613
pub fn pivot_root < P1 : ?Sized + NixPath , P2 : ?Sized + NixPath > (
1612
1614
new_root : & P1 , put_old : & P2 ) -> Result < ( ) > {
@@ -1620,6 +1622,14 @@ mod linux {
1620
1622
1621
1623
Errno :: result ( res) . map ( drop)
1622
1624
}
1625
+ }
1626
+
1627
+ #[ cfg( any( target_os = "android" , target_os = "freebsd" ,
1628
+ target_os = "linux" , target_os = "openbsd" ) ) ]
1629
+ mod setres {
1630
+ use libc;
1631
+ use { Errno , Result } ;
1632
+ use super :: { Uid , Gid } ;
1623
1633
1624
1634
/// Sets the real, effective, and saved uid.
1625
1635
/// ([see setresuid(2)](http://man7.org/linux/man-pages/man2/setresuid.2.html))
0 commit comments