-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libc: minimal: declare sig_atomic_t and signal()
We don't actually implement signal() in Zephyr, but some users require the declaration. Additionally, typedef sig_atomic_t since it is part of ISO. Signed-off-by: Christopher Friedt <cfriedt@meta.com>
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2023 Meta | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SIGNAL_H_ | ||
#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SIGNAL_H_ | ||
|
||
#define SIG_DFL ((sighandler_t)0) | ||
#define SIG_ERR ((sighandler_t)1) | ||
#define SIG_IGN ((sighandler_t)-1) | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef int sig_atomic_t; /* Atomic entity type (ANSI) */ | ||
|
||
/* Note: sighandler_t is a gnu-ism, but it simplifies the declaration below */ | ||
typedef void (*sighandler_t)(int signo); | ||
|
||
sighandler_t signal(int signum, sighandler_t handler); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SIGNAL_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2023 Meta | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <signal.h> | ||
|
||
sighandler_t signal(int signum, sighandler_t handler) | ||
{ | ||
return SIG_DFL; | ||
} |