mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 07:24:58 +00:00
Add umask().
This commit is contained in:
parent
77fe8e8363
commit
b2d23f83ab
6 changed files with 23 additions and 0 deletions
|
@ -1320,6 +1320,13 @@ pid_t Process::sys$getppid()
|
||||||
return m_ppid;
|
return m_ppid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mode_t Process::sys$umask(mode_t mask)
|
||||||
|
{
|
||||||
|
auto old_mask = m_umask;
|
||||||
|
m_umask = mask;
|
||||||
|
return old_mask;
|
||||||
|
}
|
||||||
|
|
||||||
pid_t Process::sys$waitpid(pid_t waitee, int* wstatus, int options)
|
pid_t Process::sys$waitpid(pid_t waitee, int* wstatus, int options)
|
||||||
{
|
{
|
||||||
if (wstatus)
|
if (wstatus)
|
||||||
|
|
|
@ -104,6 +104,7 @@ public:
|
||||||
gid_t sys$getegid();
|
gid_t sys$getegid();
|
||||||
pid_t sys$getpid();
|
pid_t sys$getpid();
|
||||||
pid_t sys$getppid();
|
pid_t sys$getppid();
|
||||||
|
mode_t sys$umask(mode_t);
|
||||||
int sys$open(const char* path, int options);
|
int sys$open(const char* path, int options);
|
||||||
int sys$close(int fd);
|
int sys$close(int fd);
|
||||||
ssize_t sys$read(int fd, void* outbuf, size_t nread);
|
ssize_t sys$read(int fd, void* outbuf, size_t nread);
|
||||||
|
@ -235,6 +236,7 @@ private:
|
||||||
LinearAddress m_return_from_signal_trampoline;
|
LinearAddress m_return_from_signal_trampoline;
|
||||||
|
|
||||||
pid_t m_ppid { 0 };
|
pid_t m_ppid { 0 };
|
||||||
|
mode_t m_umask { 022 };
|
||||||
|
|
||||||
static void notify_waiters(pid_t waitee, int exit_status, int signal);
|
static void notify_waiters(pid_t waitee, int exit_status, int signal);
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,8 @@ static DWORD handle(RegisterDump& regs, DWORD function, DWORD arg1, DWORD arg2,
|
||||||
return current->sys$dup2((int)arg1, (int)arg2);
|
return current->sys$dup2((int)arg1, (int)arg2);
|
||||||
case Syscall::SC_sigaction:
|
case Syscall::SC_sigaction:
|
||||||
return current->sys$sigaction((int)arg1, (const Unix::sigaction*)arg2, (Unix::sigaction*)arg3);
|
return current->sys$sigaction((int)arg1, (const Unix::sigaction*)arg2, (Unix::sigaction*)arg3);
|
||||||
|
case Syscall::SC_umask:
|
||||||
|
return current->sys$umask((mode_t)arg1);
|
||||||
default:
|
default:
|
||||||
kprintf("<%u> int0x80: Unknown function %x requested {%x, %x, %x}\n", current->pid(), function, arg1, arg2, arg3);
|
kprintf("<%u> int0x80: Unknown function %x requested {%x, %x, %x}\n", current->pid(), function, arg1, arg2, arg3);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
__ENUMERATE_SYSCALL(dup2) \
|
__ENUMERATE_SYSCALL(dup2) \
|
||||||
__ENUMERATE_SYSCALL(sigaction) \
|
__ENUMERATE_SYSCALL(sigaction) \
|
||||||
__ENUMERATE_SYSCALL(getppid) \
|
__ENUMERATE_SYSCALL(getppid) \
|
||||||
|
__ENUMERATE_SYSCALL(umask) \
|
||||||
|
|
||||||
|
|
||||||
#define DO_SYSCALL_A0(function) Syscall::invoke((dword)(function))
|
#define DO_SYSCALL_A0(function) Syscall::invoke((dword)(function))
|
||||||
|
|
|
@ -23,6 +23,7 @@ LIBC_OBJS = \
|
||||||
times.o \
|
times.o \
|
||||||
termcap.o \
|
termcap.o \
|
||||||
setjmp.o \
|
setjmp.o \
|
||||||
|
stat.o \
|
||||||
entry.o
|
entry.o
|
||||||
|
|
||||||
OBJS = $(AK_OBJS) $(LIBC_OBJS)
|
OBJS = $(AK_OBJS) $(LIBC_OBJS)
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
mode_t umask(mode_t);
|
||||||
|
|
||||||
|
__END_DECLS
|
Loading…
Add table
Add a link
Reference in a new issue