feature: Ctrl+C signal to foreground pgid
This commit is contained in:
+13
-1
@@ -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,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::*;
|
||||
|
||||
Reference in New Issue
Block a user