feature: Ctrl+C signal to foreground pgid

This commit is contained in:
2021-11-23 14:16:37 +02:00
parent 349418ed36
commit a7d89158cb
16 changed files with 340 additions and 122 deletions
+13 -1
View File
@@ -1,7 +1,11 @@
use libsys::{
calls::sys_fstatat,
calls::{sys_fstatat, sys_ioctl},
stat::{FileDescriptor, Stat},
ioctl::IoctlCmd,
error::Errno,
proc::Pid
};
use core::mem::size_of;
use core::fmt;
mod error;
@@ -24,6 +28,14 @@ pub trait AsRawFd {
fn as_raw_fd(&self) -> FileDescriptor;
}
pub fn tcgetpgrp(fd: FileDescriptor) -> Result<Pid, Errno> {
todo!()
}
pub fn tcsetpgrp(fd: FileDescriptor, pgid: Pid) -> Result<(), Errno> {
sys_ioctl(fd, IoctlCmd::TtySetPgrp, &pgid as *const _ as usize, size_of::<Pid>()).map(|_| ())
}
pub fn stat(pathname: &str) -> Result<Stat, Error> {
let mut buf = Stat::default();
// TODO error handling
+1 -1
View File
@@ -1,5 +1,5 @@
pub use libsys::signal::{Signal, SignalDestination};
pub use libsys::proc::ExitCode;
pub use libsys::proc::{self, ExitCode};
pub use libsys::termios;
pub use libsys::abi;
pub use libsys::calls::*;