Verified Commit 06217092 authored by 4lDO2's avatar 4lDO2 🖖
Browse files

Use redox-daemon in getty

parent f61edda3
......@@ -158,6 +158,16 @@ version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
[[package]]
name = "redox-daemon"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21e31c834277709c7ff3eb74959fe62be4b45b1189ba9d41fd3744cd3a9c554f"
dependencies = [
"libc",
"redox_syscall",
]
[[package]]
name = "redox_liner"
version = "0.5.1"
......@@ -250,6 +260,7 @@ version = "0.1.0"
dependencies = [
"clap",
"extra",
"redox-daemon",
"redox_liner",
"redox_syscall",
"redox_termios",
......
......@@ -53,6 +53,7 @@ path = "src/bin/usermod.rs"
[dependencies]
clap = "2.33.0"
extra = { git = "https://gitlab.redox-os.org/redox-os/libextra.git" }
redox-daemon = "0.1"
redox_liner = "0.5.1"
redox_syscall = "0.2.12"
redox_termios = "0.1.2"
......
......@@ -197,9 +197,9 @@ pub fn main() {
Err(err) => fail(&format!("getty: failed to open TTY {}: {}", tty, err), &mut stderr),
};
match unsafe { syscall::clone(syscall::CloneFlags::empty()) } {
Ok(0) => daemon(tty_fd as RawFd, clear, &mut stderr),
Ok(_) => (),
Err(err) => fail(&format!("getty: failed to fork login: {}", err), &mut stderr)
}
redox_daemon::Daemon::new(|d| {
d.ready().expect("getty: failed to notify ");
daemon(tty_fd as RawFd, clear, &mut stderr);
std::process::exit(0);
}).unwrap_or_else(|err| fail(&format!("getty: failed to fork login: {}", err), &mut stderr));
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment