mirror of
https://github.com/uutils/coreutils
synced 2024-12-15 07:42:48 +00:00
commit
ffd0685d19
8 changed files with 14 additions and 28 deletions
|
@ -24,8 +24,7 @@ extern {
|
|||
fn chroot(path: *const libc::c_char) -> libc::c_int;
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
|
||||
extern {
|
||||
fn setgroups(size: libc::c_int, list: *const libc::gid_t) -> libc::c_int;
|
||||
}
|
||||
|
@ -151,8 +150,7 @@ fn set_main_group(group: &str) {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
|
||||
fn set_groups(groups: Vec<libc::gid_t>) -> libc::c_int {
|
||||
unsafe {
|
||||
setgroups(groups.len() as libc::c_int,
|
||||
|
|
|
@ -8,8 +8,7 @@ use self::libc::{
|
|||
uid_t,
|
||||
gid_t,
|
||||
};
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
|
||||
use self::libc::time_t;
|
||||
#[cfg(target_os = "macos")]
|
||||
use self::libc::int32_t;
|
||||
|
@ -22,8 +21,7 @@ use std::os;
|
|||
use std::ptr::{null_mut, read};
|
||||
use std::string::raw::from_buf;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
|
||||
#[repr(C)]
|
||||
pub struct c_passwd {
|
||||
pub pw_name: *const c_char, /* user name */
|
||||
|
@ -50,8 +48,7 @@ pub struct c_passwd {
|
|||
pub pw_shell: *const c_char,
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
|
||||
#[repr(C)]
|
||||
pub struct utsname {
|
||||
pub sysname: [c_char, ..256],
|
||||
|
@ -170,8 +167,7 @@ pub fn get_group_list(name: *const c_char, gid: gid_t) -> Vec<gid_t> {
|
|||
groups
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
#[inline(always)]
|
||||
unsafe fn get_group_list_internal(name: *const c_char, gid: gid_t, groups: *mut gid_t, grcnt: *mut c_int) -> c_int {
|
||||
getgrouplist(name, gid, groups, grcnt)
|
||||
|
|
|
@ -104,8 +104,7 @@ No Name Default Action Description
|
|||
|
||||
*/
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
|
||||
pub static ALL_SIGNALS:[Signal<'static>, ..31] = [
|
||||
Signal{ name: "HUP", value:1 },
|
||||
Signal{ name: "INT", value:2 },
|
||||
|
|
|
@ -31,8 +31,7 @@ extern {
|
|||
fn gethostname(name: *mut libc::c_char, namelen: libc::size_t) -> libc::c_int;
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
|
||||
extern {
|
||||
fn sethostname(name: *const libc::c_char, namelen: libc::c_int) -> libc::c_int;
|
||||
}
|
||||
|
@ -148,8 +147,7 @@ fn xgethostname() -> String {
|
|||
str::from_utf8(name.slice_to(last_char)).unwrap().to_string()
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
|
||||
fn xsethostname(name: &str) {
|
||||
let vec_name: Vec<libc::c_char> = name.bytes().map(|c| c as libc::c_char).collect();
|
||||
|
||||
|
|
|
@ -251,8 +251,7 @@ fn pretty(possible_pw: Option<c_passwd>) {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
|
||||
fn pline(possible_pw: Option<c_passwd>) {
|
||||
let pw = if possible_pw.is_none() {
|
||||
unsafe { read(getpwuid(getuid())) }
|
||||
|
|
|
@ -41,12 +41,10 @@ fn rewind_stdout<T: std::rt::rtio::RtioFileStream>(s: &mut T) {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int { std::ptr::null() }
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
fn rewind_stdout<T: std::rt::rtio::RtioFileStream>(_: &mut T) {}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
|
|
|
@ -43,8 +43,7 @@ extern {
|
|||
fn setutxent();
|
||||
fn endutxent();
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
||||
fn utmpxname(file: *const c_char) -> c_int;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ extern {
|
|||
fn setutxent();
|
||||
fn endutxent();
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
||||
fn utmpxname(file: *const libc::c_char) -> libc::c_int;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue