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

Last change on this file since 450 was 449, checked in by alain, 6 years ago

Introduce several missing user libs.

File size: 3.1 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 *****************************************************************************************
39 * @ sig_id    : index defining signal type (from 1 to 31).
40 * @ handler   : pointer on fonction implementing the specific handler.
41 * @ return 0 if success / returns -1 if failure.
42 ****************************************************************************************/
43int signal( unsigned int   sig_id,
44            void         * handler );
45
46/*****************************************************************************************
47 * This function implements the "kill" system call on the user side.
48 * It register the signal defined by the <sig_id> argument in all thread descriptors
49 * of a target process identified by the <pid> argument. This is done in all clusters
50 * containing threads for the target process.
51 * It can be executed by any thread running in any cluster, as this function uses
52 * remote access to traverse the list of process copies stored in the owner cluster,
53 * and the RPC_SIGNAL_RISE to signal the remote threads.
54 * This function does nothing for (sig_id == 0). This can be used to check process pid.
55 * TODO : This first implementation supports only SIGKILL / SIGSTOP / SIGCONT values.
56 *****************************************************************************************
57 * @ pid      : target process identifier.
58 * @ sig_id   : index defining the signal type.
59 * @ return 0 if success / returns -1 if failure.
60 ****************************************************************************************/
61int kill( unsigned int  pid,
62          unsigned int  sig_id );
63
64#endif
Note: See TracBrowser for help on using the repository browser.