source: trunk/kernel/syscalls/shared_include/shared_wait.h @ 557

Last change on this file since 557 was 445, checked in by alain, 6 years ago

Restructure the mini_libc.

File size: 2.0 KB
RevLine 
[445]1/*
2 * shared_wait.h - Shared macros used by the wait() syscall.
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
24#ifndef _SHARED_WAIT_H_
25#define _SHARED_WAIT_H_
26
27/*********************************************************************************************
28 * These macros can be used by the parent process to analyze a child process termination
29 * status, as returned by the wait() syscall.
30 * The termination state is a 32 bits word:
31 * - the 8 LSB bits contain the user defined exit status
32 * - the 24 other bits contain the flags defined below
33 ********************************************************************************************/
34
35#define PROCESS_TERM_STOP  0x100            /*! process received a SIGSTOP signal           */
36#define PROCESS_TERM_KILL  0x200            /*! process killed by a SIGKILL signal          */
37#define PROCESS_TERM_EXIT  0x400            /*! process terminated by a sys_exit()          */
38#define PROCESS_TERM_WAIT  0x800            /*! parent process executed a sys_wait()        */
39
40#define WIFEXITED( status )       (status & PROCESS_TERM_EXIT)
41#define WIFSIGNALED( status )     (status & PROCESS_TERM_KILL)
42#define WIFSTOPPED( status )      (status & PROCESS_TERM_STOP)
43#define WEXITSTATUS( status )     (status & 0xFF)
44
45#define WNOHANG -1     // TODO Not implemented in almos-mkh
46
47#endif
48
Note: See TracBrowser for help on using the repository browser.