forked from Bananymous/banan-os
Kernel: Remove unnecessary raise syscall
This commit is contained in:
parent
336daa2cc5
commit
cdcc36efde
|
@ -137,7 +137,6 @@ namespace Kernel
|
|||
BAN::ErrorOr<long> sys_tty_ctrl(int fildes, int command, int flags);
|
||||
|
||||
BAN::ErrorOr<long> sys_signal(int, void (*)(int));
|
||||
BAN::ErrorOr<long> sys_raise(int signal);
|
||||
static BAN::ErrorOr<long> sys_kill(pid_t pid, int signal);
|
||||
|
||||
BAN::ErrorOr<long> sys_tcsetpgrp(int fd, pid_t pgid);
|
||||
|
|
|
@ -468,7 +468,7 @@ namespace Kernel
|
|||
if (!m_loadable_elf->is_address_space_free())
|
||||
{
|
||||
dprintln("ELF has unloadable address space");
|
||||
MUST(sys_raise(SIGKILL));
|
||||
MUST(sys_kill(pid(), SIGKILL));
|
||||
}
|
||||
m_loadable_elf->reserve_address_space();
|
||||
m_userspace_info.entry = m_loadable_elf->entry_point();
|
||||
|
@ -1218,8 +1218,12 @@ namespace Kernel
|
|||
return BAN::Error::from_errno(EINVAL);
|
||||
|
||||
if (pid == Process::current().pid())
|
||||
return Process::current().sys_raise(signal);
|
||||
|
||||
{
|
||||
CriticalScope _;
|
||||
Process::current().m_signal_pending_mask |= 1 << signal;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
for_each_process(
|
||||
[&](Process& process)
|
||||
|
@ -1243,17 +1247,6 @@ namespace Kernel
|
|||
return BAN::Error::from_errno(ESRCH);
|
||||
}
|
||||
|
||||
BAN::ErrorOr<long> Process::sys_raise(int signal)
|
||||
{
|
||||
if (signal < _SIGMIN || signal > _SIGMAX)
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
ASSERT(this == &Process::current());
|
||||
|
||||
CriticalScope _;
|
||||
Thread::current().handle_signal(signal);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BAN::ErrorOr<long> Process::sys_tcsetpgrp(int fd, pid_t pgrp)
|
||||
{
|
||||
LockGuard _(m_lock);
|
||||
|
@ -1627,7 +1620,7 @@ namespace Kernel
|
|||
unauthorized_access:
|
||||
dwarnln("process {}, thread {} attempted to make an invalid pointer access", pid(), Thread::current().tid());
|
||||
Debug::dump_stack_trace();
|
||||
MUST(sys_raise(SIGSEGV));
|
||||
MUST(sys_kill(pid(), SIGSEGV));
|
||||
}
|
||||
|
||||
}
|
|
@ -148,9 +148,6 @@ namespace Kernel
|
|||
case SYS_DUP2:
|
||||
ret = Process::current().sys_dup2((int)arg1, (int)arg2);
|
||||
break;
|
||||
case SYS_RAISE:
|
||||
ret = Process::current().sys_raise((int)arg1);
|
||||
break;
|
||||
case SYS_KILL:
|
||||
ret = Process::current().sys_kill((pid_t)arg1, (int)arg2);
|
||||
break;
|
||||
|
|
|
@ -38,7 +38,6 @@ __BEGIN_DECLS
|
|||
#define SYS_PIPE 35
|
||||
#define SYS_DUP 36
|
||||
#define SYS_DUP2 37
|
||||
#define SYS_RAISE 38
|
||||
#define SYS_KILL 39
|
||||
#define SYS_SIGNAL 40
|
||||
#define SYS_SIGNAL_DONE 41
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
int raise(int sig)
|
||||
{
|
||||
return syscall(SYS_RAISE, sig);
|
||||
// FIXME: won't work after multithreaded
|
||||
return kill(getpid(), sig);
|
||||
}
|
||||
|
||||
int kill(pid_t pid, int sig)
|
||||
|
|
Loading…
Reference in New Issue