source: trunk/libs/mini-libc/signal.h @ 605

Last change on this file since 605 was 589, checked in by alain, 6 years ago

Introduce a pause() syscall in mini-libc/unistd library.

File size: 3.2 KB
Line 
1/*
2 * signal.c - User side signals related syscalls implementation.
3 *
4 * Author     Alain Greiner (2016,2017,2018)
5 *
6 * Copyright (c) UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2.0 of the License.
13 *
14 * ALMOS-MKH is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23#ifndef _SIGNAL_H_
24#define _SIGNAL_H_
25
26/*****************************************************************************************
27 * This file defines the user side, signals related library.
28 * All these functions make a system call to access the kernel VFS.
29 * The user/kernel shared structures and mnemonics are defined in
30 * the <syscalls/shared_include/shared_signal.h> file.
31 ****************************************************************************************/
32
33#include <shared_signal.h>
34
35/*****************************************************************************************
36 * This function associate a specific signal handler to a given signal type.
37 * The handlers for the SIGKILL and SIGSTOP signals cannot be redefined.
38 * TODO : this function is not implemented yet.
39 *****************************************************************************************
40 * @ sig_id    : index defining signal type (from 1 to 31).
41 * @ handler   : pointer on fonction implementing the specific handler.
42 * @ return 0 if success / returns -1 if failure.
43 ****************************************************************************************/
44int signal( unsigned int   sig_id,
45            void         * handler );
46
47/*****************************************************************************************
48 * This function implements the "kill" system call on the user side.
49 * It register the signal defined by the <sig_id> argument in all thread descriptors
50 * of a target process identified by the <pid> argument. This is done in all clusters
51 * containing threads for the target process.
52 * It can be executed by any thread running in any cluster, as this function uses
53 * remote access to traverse the list of process copies stored in the owner cluster.
54 * This function does nothing for (sig_id == 0). This can be used to check process pid.
55 * The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
56 * TODO : only SIGKILL / SIGSTOP / SIGCONT values.
57 *****************************************************************************************
58 * @ pid      : target process identifier.
59 * @ sig_id   : index defining the signal type.
60 * @ return 0 if success / returns -1 if failure.
61 ****************************************************************************************/
62int kill( unsigned int  pid,
63          unsigned int  sig_id );
64
65#endif
Note: See TracBrowser for help on using the repository browser.