1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:07:36 +00:00

Implement basic sys$kill() and add a /bin/kill

All it can do right now is send SIGKILL which just murders the target task.
This commit is contained in:
Andreas Kling 2018-10-31 01:06:57 +01:00
parent 7be30a2fa8
commit 3218f00099
10 changed files with 117 additions and 9 deletions

View file

@ -16,6 +16,7 @@ LIBC_OBJS = \
time.o \
utsname.o \
assert.o \
signal.o \
entry.o
OBJS = $(AK_OBJS) $(LIBC_OBJS)

14
LibC/signal.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "unistd.h"
#include "errno.h"
#include <Kernel/Syscall.h>
extern "C" {
int kill(pid_t pid, int sig)
{
int rc = Syscall::invoke(Syscall::PosixKill, (dword)pid, (dword)sig);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
}

26
LibC/signal.h Normal file
View file

@ -0,0 +1,26 @@
#pragma once
#include "types.h"
extern "C" {
int kill(pid_t, int sig);
#define SIGHUP 1
#define SIGINT 2
#define SIGQUIT 3
#define SIGILL 4
#define SIGTRAP 5
#define SIGABRT 6
#define SIGBUS 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGUSR1 10
#define SIGSEGV 11
#define SIGUSR2 12
#define SIGPIPE 13
#define SIGALRM 14
#define SIGTERM 15
}