Change io crate & add a small shell

This commit is contained in:
2026-03-25 20:45:11 +01:00
parent f966a1239e
commit ae0593c972
98 changed files with 11102 additions and 810 deletions

6
user/agetty/Cargo.toml Normal file
View File

@@ -0,0 +1,6 @@
[package]
name = "agetty"
version = "0.1.0"
edition = "2024"
[dependencies]

29
user/agetty/src/main.rs Normal file
View File

@@ -0,0 +1,29 @@
#![allow(unused)]
#![feature(survos_std)]
use core::sync::atomic::AtomicUsize;
use std::fs::File;
use std::io::{Read, Stdin, Write, stdin, stdout};
use std::os::fd::FromRawFd;
fn main() {
// Close descriptor 0
let f = unsafe { File::from_raw_fd(0) };
drop(f);
// Close descriptor 1
let f = unsafe { File::from_raw_fd(1) };
drop(f);
// Open new input and output
let mut input = File::open("/dev/tty0");
let mut tty = File::open("/dev/tty0");
std::process::Command::new("/usr/bin/shell")
.spawn()
.unwrap();
loop {
std::thread::yield_now();
}
}