Commit bac44348 authored by Jeremy Soller's avatar Jeremy Soller

Switch to real standard, fix daemonization on real standard

parent 03abcd0e
......@@ -7,7 +7,7 @@ extern crate io;
extern crate spin;
extern crate syscall;
use std::{env, thread, usize};
use std::{env, usize};
use std::fs::File;
use std::io::{Read, Write};
use std::os::unix::io::{AsRawFd, FromRawFd};
......@@ -29,7 +29,8 @@ fn main() {
print!("{}", format!(" + AHCI on: {:X} IRQ: {}\n", bar, irq));
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let address = unsafe { syscall::physmap(bar, 4096, MAP_WRITE).expect("ahcid: failed to map address") };
{
let socket_fd = syscall::open(":disk", syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK).expect("ahcid: failed to create disk scheme");
......@@ -69,5 +70,5 @@ fn main() {
}
}
unsafe { let _ = syscall::physunmap(address); }
});
}
}
......@@ -6,7 +6,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};
......@@ -29,7 +29,8 @@ fn main() {
print!("{}", format!(" + E1000 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("e1000d: failed to create network scheme");
let socket = Arc::new(RefCell::new(unsafe { File::from_raw_fd(socket_fd) }));
......@@ -128,5 +129,5 @@ fn main() {
}
}
unsafe { let _ = syscall::physunmap(address); }
});
}
}
......@@ -11,7 +11,7 @@ use std::env;
use std::fs::File;
use std::io::{Read, Write, Result};
use std::os::unix::io::AsRawFd;
use std::{mem, thread};
use std::mem;
use event::EventQueue;
use orbclient::{KeyEvent, MouseEvent};
......@@ -123,7 +123,8 @@ impl<'a> Ps2d<'a> {
}
fn main() {
thread::spawn(|| {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
unsafe {
iopl(3).expect("ps2d: failed to get I/O permission");
asm!("cli" : : : : "intel", "volatile");
......@@ -188,5 +189,5 @@ fn main() {
let (keyboard, data) = event_queue.run().expect("ps2d: failed to handle events");
ps2d.handle(keyboard, data);
}
});
}
}
......@@ -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); }
});
}
}
......@@ -6,7 +6,7 @@ extern crate alloc;
extern crate orbclient;
extern crate syscall;
use std::{env, mem, thread};
use std::{env, mem};
use std::fs::File;
use std::io::{Read, Write};
use syscall::{physmap, physunmap, Packet, SchemeMut, EVENT_READ, MAP_WRITE, MAP_WRITE_COMBINE};
......@@ -49,7 +49,8 @@ fn main() {
}
if physbaseptr > 0 {
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let mut socket = File::create(":display").expect("vesad: failed to create display scheme");
let size = width * height;
......@@ -103,6 +104,6 @@ fn main() {
}
}
}
});
}
}
}
Markdown is supported
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