Kernel/LibC: Implement pthread_kill

This commit is contained in:
2025-06-01 00:56:23 +03:00
parent c957f1ddca
commit 56fdf6002c
4 changed files with 37 additions and 2 deletions

View File

@@ -103,6 +103,7 @@ __BEGIN_DECLS
O(SYS_PTHREAD_EXIT, pthread_exit) \
O(SYS_PTHREAD_JOIN, pthread_join) \
O(SYS_PTHREAD_SELF, pthread_self) \
O(SYS_PTHREAD_KILL, pthread_kill) \
O(SYS_EPOLL_CREATE1, epoll_create1) \
O(SYS_EPOLL_CTL, epoll_ctl) \
O(SYS_EPOLL_PWAIT2, epoll_pwait2) \

View File

@@ -38,9 +38,18 @@ void psignal(int signum, const char* message)
fprintf(stderr, "%s\n", strsignal(signum));
}
int pthread_kill(pthread_t thread, int sig)
{
if (syscall(SYS_PTHREAD_KILL, thread, sig) == -1)
return errno;
return 0;
}
int pthread_sigmask(int how, const sigset_t* __restrict set, sigset_t* __restrict oset)
{
return syscall(SYS_SIGPROCMASK, how, set, oset);
if (syscall(SYS_SIGPROCMASK, how, set, oset) == -1)
return errno;
return 0;
}
int raise(int sig)
@@ -138,7 +147,12 @@ int sigpending(sigset_t* set)
int sigprocmask(int how, const sigset_t* __restrict set, sigset_t* __restrict oset)
{
return pthread_sigmask(how, set, oset);
if (int error = pthread_sigmask(how, set, oset))
{
errno = error;
return -1;
}
return 0;
}
int sigrelse(int sig)