Switch to real standard, fix daemonization on real standard
This commit is contained in:
parent
da3f9558d9
commit
2db2d10cce
15 changed files with 55 additions and 45 deletions
|
@ -7,7 +7,7 @@ extern crate netutils;
|
|||
extern crate syscall;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::{env, thread};
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Write, Result};
|
||||
use std::os::unix::io::{AsRawFd, FromRawFd};
|
||||
|
@ -30,7 +30,8 @@ fn main() {
|
|||
|
||||
print!("{}", format!(" + RTL8168 on: {:X}, IRQ: {}\n", bar, irq));
|
||||
|
||||
thread::spawn(move || {
|
||||
// Daemonize
|
||||
if unsafe { syscall::clone(0).unwrap() } == 0 {
|
||||
let socket_fd = syscall::open(":network", syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK).expect("rtl8168d: failed to create network scheme");
|
||||
let socket = Arc::new(RefCell::new(unsafe { File::from_raw_fd(socket_fd) }));
|
||||
|
||||
|
@ -133,5 +134,5 @@ fn main() {
|
|||
}
|
||||
}
|
||||
unsafe { let _ = syscall::physunmap(address); }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue