Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,8 @@ feat_os_unix_fuchsia = [
feat_os_unix_redox = [
"feat_common_core",
#
"uname",
"chmod",
"install",
"uname",
]
# "feat_os_windows_legacy" == slightly restricted set of utilities which can be built/run on early windows platforms (eg, "WinXP")
feat_os_windows_legacy = [
Expand Down
14 changes: 11 additions & 3 deletions src/uu/date/src/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use chrono::{DateTime, FixedOffset, Local, Offset, Utc};
#[cfg(windows)]
use chrono::{Datelike, Timelike};
use clap::{crate_version, App, Arg};
#[cfg(all(unix, not(target_os = "macos")))]
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
use libc::{clock_settime, timespec, CLOCK_REALTIME};
use std::fs::File;
use std::io::{BufRead, BufReader};
Expand Down Expand Up @@ -67,10 +67,12 @@ static RFC_3339_HELP_STRING: &str = "output date/time in RFC 3339 format.
for date and time to the indicated precision.
Example: 2006-08-14 02:34:56-06:00";

#[cfg(not(target_os = "macos"))]
#[cfg(not(any(target_os = "macos", target_os = "redox")))]
static OPT_SET_HELP_STRING: &str = "set time described by STRING";
#[cfg(target_os = "macos")]
static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on mac yet)";
#[cfg(target_os = "redox")]
static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on redox yet)";

/// Settings for this program, parsed from the command line
struct Settings {
Expand Down Expand Up @@ -357,7 +359,13 @@ fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
1
}

#[cfg(all(unix, not(target_os = "macos")))]
#[cfg(target_os = "redox")]
fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
eprintln!("date: setting the date is not supported by Redox");
1
}

#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
/// System call to set date (unix).
/// See here for more:
/// https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html
Expand Down
4 changes: 3 additions & 1 deletion src/uu/dd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ byte-unit = "4.0"
clap = { version = "2.33", features = [ "wrap_help" ] }
gcd = "2.0"
libc = "0.2"
signal-hook = "0.3.9"
uucore = { version=">=0.0.8", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" }

[dev-dependencies]
tempfile = "^3"

[target.'cfg(target_os = "linux")'.dependencies]
signal-hook = "0.3.9"

[[bin]]
name = "dd"
path = "src/main.rs"
9 changes: 7 additions & 2 deletions src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ fn display_uname(metadata: &Metadata, config: &Config) -> String {
}
}

#[cfg(unix)]
#[cfg(all(unix, not(target_os = "redox")))]
fn cached_gid2grp(gid: u32) -> String {
lazy_static! {
static ref GID_CACHE: Mutex<HashMap<u32, String>> = Mutex::new(HashMap::new());
Expand All @@ -1603,7 +1603,7 @@ fn cached_gid2grp(gid: u32) -> String {
.clone()
}

#[cfg(unix)]
#[cfg(all(unix, not(target_os = "redox")))]
fn display_group(metadata: &Metadata, config: &Config) -> String {
if config.long.numeric_uid_gid {
metadata.gid().to_string()
Expand All @@ -1612,6 +1612,11 @@ fn display_group(metadata: &Metadata, config: &Config) -> String {
}
}

#[cfg(target_os = "redox")]
fn display_group(metadata: &Metadata, config: &Config) -> String {
metadata.gid().to_string()
}

#[cfg(not(unix))]
fn display_uname(_metadata: &Metadata, _config: &Config) -> String {
"somebody".to_string()
Expand Down
2 changes: 1 addition & 1 deletion src/uu/more/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ unicode-segmentation = "1.7.1"

[target.'cfg(target_os = "redox")'.dependencies]
redox_termios = "0.1"
redox_syscall = "0.1"
redox_syscall = "0.2"

[target.'cfg(all(unix, not(target_os = "fuchsia")))'.dependencies]
nix = "<=0.13"
Expand Down
2 changes: 1 addition & 1 deletion src/uu/pr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ path = "src/pr.rs"

[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx", "entries"] }
uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries"] }
uucore_procs = { version=">=0.0.6", package="uucore_procs", path="../../uucore_procs" }
getopts = "0.2.21"
time = "0.1.41"
Expand Down
2 changes: 1 addition & 1 deletion src/uu/tail/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ uucore_procs = { version=">=0.0.6", package="uucore_procs", path="../../uucore_p
winapi = { version="0.3", features=["fileapi", "handleapi", "processthreadsapi", "synchapi", "winbase"] }

[target.'cfg(target_os = "redox")'.dependencies]
redox_syscall = "0.1"
redox_syscall = "0.2"

[target.'cfg(unix)'.dependencies]
nix = "0.20"
Expand Down
6 changes: 0 additions & 6 deletions src/uu/tail/src/platform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ pub use self::unix::{stdin_is_pipe_or_fifo, supports_pid_checks, Pid, ProcessChe
#[cfg(windows)]
pub use self::windows::{supports_pid_checks, Pid, ProcessChecker};

#[cfg(target_os = "redox")]
pub use self::redox::{supports_pid_checks, Pid, ProcessChecker};

#[cfg(unix)]
mod unix;

#[cfg(windows)]
mod windows;

#[cfg(target_os = "redox")]
mod redox;
25 changes: 0 additions & 25 deletions src/uu/tail/src/platform/redox.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/uu/test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ uucore = { version=">=0.0.9", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.6", package="uucore_procs", path="../../uucore_procs" }

[target.'cfg(target_os = "redox")'.dependencies]
redox_syscall = "0.1"
redox_syscall = "0.2"

[[bin]]
name = "test"
Expand Down
4 changes: 2 additions & 2 deletions src/uucore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ edition = "2018"
path="src/lib/lib.rs"

[dependencies]
dns-lookup = "1.0.5"
dns-lookup = { version="1.0.5", optional=true }
dunce = "1.0.0"
getopts = "<= 0.2.21"
wild = "2.0.4"
Expand Down Expand Up @@ -55,6 +55,6 @@ process = ["libc"]
ringbuffer = []
signals = []
utf8 = []
utmpx = ["time", "libc"]
utmpx = ["time", "libc", "dns-lookup"]
wide = []
zero-copy = ["nix", "libc", "lazy_static", "platform-info"]
1 change: 1 addition & 0 deletions src/uucore/src/lib/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub mod signals;
#[cfg(all(
unix,
not(target_os = "fuchsia"),
not(target_os = "redox"),
not(target_env = "musl"),
feature = "utmpx"
))]
Expand Down
10 changes: 8 additions & 2 deletions src/uucore/src/lib/features/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
#[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
use libc::time_t;
use libc::{c_char, c_int, gid_t, uid_t};
use libc::{getgrgid, getgrnam, getgroups, getpwnam, getpwuid, group, passwd};
#[cfg(not(target_os = "redox"))]
use libc::{getgrgid, getgrnam, getgroups};
use libc::{getpwnam, getpwuid, group, passwd};

use std::borrow::Cow;
use std::ffi::{CStr, CString};
Expand Down Expand Up @@ -65,6 +67,7 @@ extern "C" {
/// > supplementary group IDs for the process is returned. This allows
/// > the caller to determine the size of a dynamically allocated list
/// > to be used in a further call to getgroups().
#[cfg(not(target_os = "redox"))]
pub fn get_groups() -> IOResult<Vec<gid_t>> {
let ngroups = unsafe { getgroups(0, ptr::null_mut()) };
if ngroups == -1 {
Expand Down Expand Up @@ -104,7 +107,7 @@ pub fn get_groups() -> IOResult<Vec<gid_t>> {
/// > groups is the same (in the mathematical sense of ``set''). (The
/// > history of a process and its parents could affect the details of
/// > the result.)
#[cfg(all(unix, feature = "process"))]
#[cfg(all(unix, not(target_os = "redox"), feature = "process"))]
pub fn get_groups_gnu(arg_id: Option<u32>) -> IOResult<Vec<gid_t>> {
let groups = get_groups()?;
let egid = arg_id.unwrap_or_else(crate::features::process::getegid);
Expand Down Expand Up @@ -319,13 +322,15 @@ macro_rules! f {
}

f!(getpwnam, getpwuid, uid_t, Passwd);
#[cfg(not(target_os = "redox"))]
f!(getgrnam, getgrgid, gid_t, Group);

#[inline]
pub fn uid2usr(id: uid_t) -> IOResult<String> {
Passwd::locate(id).map(|p| p.name().into_owned())
}

#[cfg(not(target_os = "redox"))]
#[inline]
pub fn gid2grp(id: gid_t) -> IOResult<String> {
Group::locate(id).map(|p| p.name().into_owned())
Expand All @@ -336,6 +341,7 @@ pub fn usr2uid(name: &str) -> IOResult<uid_t> {
Passwd::locate(name).map(|p| p.uid())
}

#[cfg(not(target_os = "redox"))]
#[inline]
pub fn grp2gid(name: &str) -> IOResult<gid_t> {
Group::locate(name).map(|p| p.gid())
Expand Down
2 changes: 0 additions & 2 deletions src/uucore/src/lib/features/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ use libc::{
use std::borrow::Cow;
use std::env;
use std::fs;
#[cfg(target_os = "redox")]
use std::io;
use std::io::Result as IOResult;
use std::io::{Error, ErrorKind};
#[cfg(any(unix, target_os = "redox"))]
Expand Down
11 changes: 9 additions & 2 deletions src/uucore/src/lib/features/fsext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ pub use libc::statfs as StatFs;
target_os = "netbsd",
target_os = "openbsd",
target_os = "bitrig",
target_os = "dragonfly"
target_os = "dragonfly",
target_os = "redox"
))]
pub use libc::statvfs as StatFs;

Expand All @@ -110,7 +111,8 @@ pub use libc::statfs as statfs_fn;
target_os = "netbsd",
target_os = "openbsd",
target_os = "bitrig",
target_os = "dragonfly"
target_os = "dragonfly",
target_os = "redox"
))]
pub use libc::statvfs as statfs_fn;

Expand Down Expand Up @@ -438,6 +440,11 @@ pub fn read_fs_list() -> Vec<MountInfo> {
}
mounts
}
#[cfg(target_os = "redox")]
{
// No method to read mounts, yet
Vec::new()
}
}

#[derive(Debug, Clone)]
Expand Down
6 changes: 0 additions & 6 deletions src/uucore/src/lib/features/mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ pub fn parse_symbolic(
#[cfg(unix)]
use libc::umask;

#[cfg(target_os = "redox")]
unsafe fn umask(_mask: u32) -> u32 {
// XXX Redox does not currently have umask
0
}

let (mask, pos) = parse_levels(mode);
if pos == mode.len() {
return Err(format!("invalid mode ({})", mode));
Expand Down
Loading