From 048042b0e1777d030a6acd7a10107eb9645eb090 Mon Sep 17 00:00:00 2001 From: Andre Maroneze <andre.maroneze@cea.fr> Date: Tue, 22 Jun 2021 09:09:45 +0200 Subject: [PATCH] [Libc] add constant NSIG (and _NSIG for Linux machdeps) --- share/libc/__fc_machdep.h | 3 ++- share/libc/__fc_machdep_linux_shared.h | 4 ++++ share/libc/signal.h | 6 ++++++ tests/libc/oracle/signal_h.res.oracle | 3 ++- tests/libc/signal_h.c | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/share/libc/__fc_machdep.h b/share/libc/__fc_machdep.h index 6af1bbe7c38..4e49988157b 100644 --- a/share/libc/__fc_machdep.h +++ b/share/libc/__fc_machdep.h @@ -774,7 +774,8 @@ //NOT IN MSVC: #define __FC_ERFKILL //NOT IN MSVC: #define __FC_EHWPOISON - +/* signal.h */ +#define __FC_NSIG 23 // End of MSVC_X86_64 #else diff --git a/share/libc/__fc_machdep_linux_shared.h b/share/libc/__fc_machdep_linux_shared.h index 03639befe95..a050f99a3ad 100644 --- a/share/libc/__fc_machdep_linux_shared.h +++ b/share/libc/__fc_machdep_linux_shared.h @@ -271,4 +271,8 @@ /* time.h */ #define __FC_TIME_T long +/* signal.h */ +#define __FC_NSIG 65 +#define __FC__NSIG __FC_NSIG + #endif diff --git a/share/libc/signal.h b/share/libc/signal.h index 37749792bb6..4d2102c0fe9 100644 --- a/share/libc/signal.h +++ b/share/libc/signal.h @@ -27,6 +27,7 @@ #include "features.h" __PUSH_FC_STDLIB +#include "__fc_machdep.h" #include "__fc_define_pid_t.h" #include "__fc_define_uid_and_gid.h" #include "__fc_define_pthread_types.h" @@ -101,6 +102,11 @@ extern void __fc_sig_err(int); #define SIGRTMIN 32 #define SIGRTMAX 64 +#define NSIG __FC_NSIG +#ifdef __FC__NSIG +#define _NSIG __FC__NSIG +#endif + #define SA_NOCLDSTOP 0x00000001 #define SA_NOCLDWAIT 0x00000002 #define SA_SIGINFO 0x00000004 diff --git a/tests/libc/oracle/signal_h.res.oracle b/tests/libc/oracle/signal_h.res.oracle index 2b9a206e15c..aa2b3157f65 100644 --- a/tests/libc/oracle/signal_h.res.oracle +++ b/tests/libc/oracle/signal_h.res.oracle @@ -126,7 +126,7 @@ function sigaction: precondition 'valid_read_act_or_null' got status valid. [eva] tests/libc/signal_h.c:48: function sigaction: precondition 'separation,separated_acts' got status valid. -[eva] share/libc/signal.h:216: +[eva] share/libc/signal.h:222: cannot evaluate ACSL term, unsupported ACSL construct: logic coercion struct sigaction -> set<struct sigaction> [eva] Done for function sigaction [eva] computing for function sigaction <- main. @@ -142,6 +142,7 @@ [eva:invalid-assigns] tests/libc/signal_h.c:51: Completely invalid destination for assigns clause *oldact. Ignoring. [eva] Done for function sigaction +[eva] tests/libc/signal_h.c:55: assertion 'valid_nsig' got status valid. [eva] Recording results for main [eva] done for function main [eva] ====== VALUES COMPUTED ====== diff --git a/tests/libc/signal_h.c b/tests/libc/signal_h.c index c0d539f925a..bfb2fb979f9 100644 --- a/tests/libc/signal_h.c +++ b/tests/libc/signal_h.c @@ -52,5 +52,7 @@ int main() { return -1; } + //@ assert valid_nsig: NSIG >= 0; + return 0; } -- GitLab