Added kill() implementation, user part of sigprocmask() now works.
Renamed syscalls. Cleaned up files. Removed unnecessary grist from source files. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8771 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
SubDir OBOS_TOP src kernel libroot posix signal ;
|
SubDir OBOS_TOP src kernel libroot posix signal ;
|
||||||
|
|
||||||
KernelMergeObject posix_signal.o :
|
KernelMergeObject posix_signal.o :
|
||||||
<$(SOURCE_GRIST)>raise.c
|
kill.c
|
||||||
<$(SOURCE_GRIST)>send_signal.c
|
raise.c
|
||||||
<$(SOURCE_GRIST)>sigaction.c
|
send_signal.c
|
||||||
<$(SOURCE_GRIST)>signal.c
|
sigaction.c
|
||||||
<$(SOURCE_GRIST)>sigprocmask.c
|
signal.c
|
||||||
<$(SOURCE_GRIST)>sigset.c
|
sigprocmask.c
|
||||||
<$(SOURCE_GRIST)>strsignal.c
|
sigset.c
|
||||||
:
|
strsignal.c
|
||||||
-fPIC -DPIC
|
: -fPIC -DPIC
|
||||||
;
|
;
|
||||||
|
|
||||||
# there are no files in the kernel
|
# there are no files in the kernel
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
** Distributed under the terms of the Haiku License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
kill(pid_t pid, int sig)
|
||||||
|
{
|
||||||
|
status_t status = send_signal(pid, (uint)sig);
|
||||||
|
if (status < B_OK) {
|
||||||
|
errno = status;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,24 +1,19 @@
|
|||||||
#include <syscalls.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, OpenBeOS Project. All rights reserved.
|
* Copyright (c) 2002-2004, Haiku Project. All rights reserved.
|
||||||
* Distributed under the terms of the OpenBeOS license.
|
* Distributed under the terms of the Haiku license.
|
||||||
*
|
|
||||||
*
|
|
||||||
* raise.c:
|
|
||||||
* implements the signal function raise()
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* Author(s):
|
* Author(s):
|
||||||
* Daniel Reinhold ([email protected])
|
* Daniel Reinhold ([email protected])
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
raise(int sig)
|
raise(int sig)
|
||||||
{
|
{
|
||||||
return sys_send_signal(find_thread(NULL), sig);
|
return send_signal(find_thread(NULL), sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,19 @@
|
|||||||
#include <syscalls.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, OpenBeOS Project. All rights reserved.
|
* Copyright (c) 2002-2004, Haiku Project. All rights reserved.
|
||||||
* Distributed under the terms of the OpenBeOS license.
|
* Distributed under the terms of the Haiku license.
|
||||||
*
|
|
||||||
* send_signal.c:
|
|
||||||
* implements the signal function send_signal()
|
|
||||||
* this is merely a wrapper for a syscall
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* Author(s):
|
* Author(s):
|
||||||
* Daniel Reinhold ([email protected])
|
* Daniel Reinhold ([email protected])
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <syscalls.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
send_signal(pid_t tid, uint sig)
|
send_signal(pid_t thread, uint sig)
|
||||||
{
|
{
|
||||||
return sys_send_signal(tid, sig);
|
return _kern_send_signal(thread, sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
#include <syscalls.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, OpenBeOS Project. All rights reserved.
|
* Copyright (c) 2002-2004, Haiku Project. All rights reserved.
|
||||||
* Distributed under the terms of the OpenBeOS license.
|
* Distributed under the terms of the Haiku license.
|
||||||
*
|
|
||||||
*
|
|
||||||
* sigaction.c:
|
|
||||||
* implements the signal function sigaction()
|
|
||||||
* this is merely a wrapper for a syscall
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* Author(s):
|
* Author(s):
|
||||||
* Daniel Reinhold ([email protected])
|
* Daniel Reinhold ([email protected])
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <syscalls.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
|
sigaction(int sig, const struct sigaction *action, struct sigaction *oldAction)
|
||||||
{
|
{
|
||||||
return sys_sigaction(sig, act, oact);
|
return _kern_sigaction(sig, action, oldAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,44 +1,37 @@
|
|||||||
#include <syscalls.h>
|
/*
|
||||||
|
* Copyright (c) 2002-2004, Haiku Project. All rights reserved.
|
||||||
|
* Distributed under the terms of the Haiku license.
|
||||||
|
*
|
||||||
|
* Author(s):
|
||||||
|
* Daniel Reinhold ([email protected])
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2002, OpenBeOS Project. All rights reserved.
|
|
||||||
* Distributed under the terms of the OpenBeOS license.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* signal.c:
|
|
||||||
* implements the standard C library function signal()
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Author(s):
|
|
||||||
* Daniel Reinhold ([email protected])
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
sig_func_t
|
sig_func_t
|
||||||
signal(int sig, sig_func_t signal_handler)
|
signal(int sig, sig_func_t signalHandler)
|
||||||
{
|
{
|
||||||
|
struct sigaction newAction, oldAction;
|
||||||
int err;
|
int err;
|
||||||
struct sigaction repl, orig;
|
|
||||||
|
|
||||||
// setup the replacement sigaction
|
// setup the replacement sigaction
|
||||||
repl.sa_handler = signal_handler;
|
newAction.sa_handler = signalHandler;
|
||||||
repl.sa_mask = 0;
|
newAction.sa_mask = 0;
|
||||||
repl.sa_flags = 0;
|
newAction.sa_flags = 0;
|
||||||
|
|
||||||
// install the replacement sigaction for the signal 'sig' into
|
// install the replacement sigaction for the signal 'sig' into
|
||||||
// the current thread (the original is copied into the last param)
|
// the current thread (the original is copied into the last param)
|
||||||
err = sys_sigaction(sig, &repl, &orig);
|
err = sigaction(sig, &newAction, &oldAction);
|
||||||
if (err == 0)
|
if (err < B_OK) {
|
||||||
// success, return the original handler
|
|
||||||
return orig.sa_handler;
|
|
||||||
else {
|
|
||||||
errno = err;
|
errno = err;
|
||||||
return SIG_ERR;
|
return SIG_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// success, return the original handler
|
||||||
|
return oldAction.sa_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
** Distributed under the terms of the Haiku License.
|
** Distributed under the terms of the Haiku License.
|
||||||
*/
|
*/
|
||||||
@@ -7,14 +7,18 @@
|
|||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sigprocmask(int how, const sigset_t *set, sigset_t *oset)
|
sigprocmask(int how, const sigset_t *set, sigset_t *oldSet)
|
||||||
{
|
{
|
||||||
// ToDo: implement me!
|
/* int status = sigprocmask(how, set, oldSet);
|
||||||
fprintf(stderr, "sigprocmask(): NOT IMPLEMENTED\n");
|
if (status < B_OK) {
|
||||||
return -1;
|
errno = status;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user