Add getuid, getgid, geteuid, getegid, etc.
This commit is contained in:
parent
e335e8df1d
commit
785d3237b9
@ -10,7 +10,7 @@ lazy_static! {
|
|||||||
task: Default::default(),
|
task: Default::default(),
|
||||||
status: Default::default(),
|
status: Default::default(),
|
||||||
pid: 0,
|
pid: 0,
|
||||||
pgid: 0,
|
pgid: 1,
|
||||||
tgid: 0,
|
tgid: 0,
|
||||||
exit_status: 0,
|
exit_status: 0,
|
||||||
cwd: "/".to_owned(),
|
cwd: "/".to_owned(),
|
||||||
@ -38,7 +38,7 @@ impl Process {
|
|||||||
task: task,
|
task: task,
|
||||||
status: Default::default(),
|
status: Default::default(),
|
||||||
pid: new_pid,
|
pid: new_pid,
|
||||||
pgid: new_pid,
|
pgid: 1, // TODO: implement pgid
|
||||||
tgid: new_pid,
|
tgid: new_pid,
|
||||||
cwd: cwd.to_owned(),
|
cwd: cwd.to_owned(),
|
||||||
clear_child_tid: None,
|
clear_child_tid: None,
|
||||||
|
@ -68,6 +68,8 @@ pub fn do_clone(
|
|||||||
let mut new_thread = new_thread_ref.lock().unwrap();
|
let mut new_thread = new_thread_ref.lock().unwrap();
|
||||||
parent.children.push(Arc::downgrade(&new_thread_ref));
|
parent.children.push(Arc::downgrade(&new_thread_ref));
|
||||||
new_thread.parent = Some(parent_ref.clone());
|
new_thread.parent = Some(parent_ref.clone());
|
||||||
|
|
||||||
|
new_thread.tgid = current.tgid;
|
||||||
}
|
}
|
||||||
|
|
||||||
process_table::put(new_thread_pid, new_thread_ref.clone());
|
process_table::put(new_thread_pid, new_thread_ref.clone());
|
||||||
|
@ -86,6 +86,12 @@ pub extern "C" fn dispatch_syscall(
|
|||||||
SYS_GETPID => do_getpid(),
|
SYS_GETPID => do_getpid(),
|
||||||
SYS_GETTID => do_gettid(),
|
SYS_GETTID => do_gettid(),
|
||||||
SYS_GETPPID => do_getppid(),
|
SYS_GETPPID => do_getppid(),
|
||||||
|
SYS_GETPGID => do_getpgid(),
|
||||||
|
|
||||||
|
SYS_GETUID => do_getuid(),
|
||||||
|
SYS_GETGID => do_getgid(),
|
||||||
|
SYS_GETEUID => do_geteuid(),
|
||||||
|
SYS_GETEGID => do_getegid(),
|
||||||
|
|
||||||
SYS_RT_SIGACTION => do_rt_sigaction(),
|
SYS_RT_SIGACTION => do_rt_sigaction(),
|
||||||
SYS_RT_SIGPROCMASK => do_rt_sigprocmask(),
|
SYS_RT_SIGPROCMASK => do_rt_sigprocmask(),
|
||||||
@ -577,6 +583,30 @@ fn do_getppid() -> Result<isize, Error> {
|
|||||||
Ok(ppid as isize)
|
Ok(ppid as isize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn do_getpgid() -> Result<isize, Error> {
|
||||||
|
let pgid = process::do_getpgid();
|
||||||
|
Ok(pgid as isize)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: implement uid, gid, euid, egid
|
||||||
|
|
||||||
|
fn do_getuid() -> Result<isize, Error> {
|
||||||
|
Ok(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn do_getgid() -> Result<isize, Error> {
|
||||||
|
Ok(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn do_geteuid() -> Result<isize, Error> {
|
||||||
|
Ok(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn do_getegid() -> Result<isize, Error> {
|
||||||
|
Ok(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fn do_pipe2(fds_u: *mut i32, flags: u32) -> Result<isize, Error> {
|
fn do_pipe2(fds_u: *mut i32, flags: u32) -> Result<isize, Error> {
|
||||||
check_mut_array(fds_u, 2)?;
|
check_mut_array(fds_u, 2)?;
|
||||||
// TODO: how to deal with open flags???
|
// TODO: how to deal with open flags???
|
||||||
|
Loading…
Reference in New Issue
Block a user