From 5975cc9d960acf3ec352b50d5a3425c27d67cd3d Mon Sep 17 00:00:00 2001 From: ouyangxiangzhen Date: Thu, 11 Jul 2024 21:13:09 +0800 Subject: [PATCH] signal: Make struct sigevent compatible with glibc This patch added compatible struct sigevent definition with glibc. Signed-off-by: ouyangxiangzhen --- include/signal.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/include/signal.h b/include/signal.h index 39718d7963ad4..d2765a07f1d91 100644 --- a/include/signal.h +++ b/include/signal.h @@ -337,19 +337,33 @@ union sigval typedef CODE void (*sigev_notify_function_t)(union sigval value); -struct sigevent +typedef struct sigevent { uint8_t sigev_notify; /* Notification method: SIGEV_SIGNAL, SIGEV_NONE, or SIGEV_THREAD */ uint8_t sigev_signo; /* Notification signal */ union sigval sigev_value; /* Data passed with notification */ + union + { #ifdef CONFIG_SIG_EVTHREAD - sigev_notify_function_t sigev_notify_function; /* Notification function */ - FAR struct pthread_attr_s *sigev_notify_attributes; /* Notification attributes (not used) */ + struct + { + /* Notification function */ + + sigev_notify_function_t _function; + + /* Notification attributes (not used) */ + + FAR struct pthread_attr_s *_attribute; + } _sigev_thread; #endif + pid_t _tid; /* ID of thread to signal */ + } _sigev_un; +} sigevent_t; - pid_t sigev_notify_thread_id; /* ID of thread to signal */ -}; +#define sigev_notify_function _sigev_un._sigev_thread._function +#define sigev_notify_attributes _sigev_un._sigev_thread._attribute +#define sigev_notify_thread_id _sigev_un._tid /* The following types is used to pass parameters to/from signal handlers */