posix: signal: define max rt signals as zero when not enabled
When CONFIG_POSIX_SIGNAL=n, default CONFIG_POSIX_RTSIG_MAX to 0 so that the `sigset_t` type can be defined. Also define RTSIG_MAX. This allows native_sim and other platforms to build without error. Signed-off-by: Christopher Friedt <cfriedt@meta.com>
This commit is contained in:
parent
e867c6f36d
commit
73930c25f2
|
@ -12,7 +12,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POSIX_SIGNAL
|
||||
#define SIGHUP 1 /**< Hangup */
|
||||
#define SIGINT 2 /**< Interrupt */
|
||||
#define SIGQUIT 3 /**< Quit */
|
||||
|
@ -45,24 +44,17 @@ extern "C" {
|
|||
/* 30 not used */
|
||||
#define SIGSYS 31 /**< Bad system call */
|
||||
|
||||
#define RTSIG_MAX CONFIG_POSIX_RTSIG_MAX
|
||||
#define SIGRTMIN 32
|
||||
#define SIGRTMAX (SIGRTMIN + CONFIG_POSIX_RTSIG_MAX)
|
||||
#define SIGRTMAX (SIGRTMIN + RTSIG_MAX)
|
||||
#define _NSIG (SIGRTMAX + 1)
|
||||
|
||||
BUILD_ASSERT(CONFIG_POSIX_RTSIG_MAX >= 0);
|
||||
BUILD_ASSERT(RTSIG_MAX >= 0);
|
||||
|
||||
typedef struct {
|
||||
unsigned long sig[DIV_ROUND_UP(_NSIG, BITS_PER_LONG)];
|
||||
} sigset_t;
|
||||
|
||||
char *strsignal(int signum);
|
||||
int sigemptyset(sigset_t *set);
|
||||
int sigfillset(sigset_t *set);
|
||||
int sigaddset(sigset_t *set, int signo);
|
||||
int sigdelset(sigset_t *set, int signo);
|
||||
int sigismember(const sigset_t *set, int signo);
|
||||
#endif /* CONFIG_POSIX_SIGNAL */
|
||||
|
||||
#ifndef SIGEV_NONE
|
||||
#define SIGEV_NONE 1
|
||||
#endif
|
||||
|
@ -90,6 +82,15 @@ struct sigevent {
|
|||
pthread_attr_t *sigev_notify_attributes;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_POSIX_SIGNAL
|
||||
char *strsignal(int signum);
|
||||
int sigemptyset(sigset_t *set);
|
||||
int sigfillset(sigset_t *set);
|
||||
int sigaddset(sigset_t *set, int signo);
|
||||
int sigdelset(sigset_t *set, int signo);
|
||||
int sigismember(const sigset_t *set, int signo);
|
||||
#endif /* CONFIG_POSIX_SIGNAL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -9,12 +9,6 @@ config POSIX_SIGNAL
|
|||
Enable support for POSIX signal APIs.
|
||||
|
||||
if POSIX_SIGNAL
|
||||
config POSIX_RTSIG_MAX
|
||||
int "Maximum number of realtime signals"
|
||||
default 31
|
||||
help
|
||||
Define the maximum number of realtime signals (RTSIG_MAX).
|
||||
The range of realtime signals is [SIGRTMIN .. (SIGRTMIN+RTSIG_MAX)]
|
||||
|
||||
config POSIX_SIGNAL_STRING_DESC
|
||||
bool "Use full description for the strsignal API"
|
||||
|
@ -24,3 +18,12 @@ config POSIX_SIGNAL_STRING_DESC
|
|||
Will use 256 bytes of ROM.
|
||||
|
||||
endif
|
||||
|
||||
# needed outside of if clause above to define constants & types in signal.h
|
||||
config POSIX_RTSIG_MAX
|
||||
int "Maximum number of realtime signals"
|
||||
default 31 if POSIX_SIGNAL
|
||||
default 0 if !POSIX_SIGNAL
|
||||
help
|
||||
Define the maximum number of realtime signals (RTSIG_MAX).
|
||||
The range of realtime signals is [SIGRTMIN .. (SIGRTMIN+RTSIG_MAX)]
|
||||
|
|
Loading…
Reference in New Issue