Skip to content

Commit 9f1e4fa

Browse files
cfriedtcarlescufi
authored andcommitted
posix: signal: type corrections for sigval, sigevent, notify attr
* `struct sigevent` is not type-defined * `union sigval` is not type-defined * `struct sigevent` must include `sigev_notify_attributes` For more information, see https://bit.ly/3YfnELI Signed-off-by: Christopher Friedt <[email protected]>
1 parent 33c3052 commit 9f1e4fa

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

include/zephyr/posix/posix_types.h

-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ typedef uint32_t clockid_t;
3535
typedef unsigned long timer_t;
3636
#endif
3737

38-
#ifdef CONFIG_PTHREAD_IPC
3938
/* Thread attributes */
4039
struct pthread_attr {
4140
int priority;
@@ -101,8 +100,6 @@ typedef struct pthread_rwlock_obj {
101100
k_tid_t wr_owner;
102101
} pthread_rwlock_t;
103102

104-
#endif /* CONFIG_PTHREAD_IPC */
105-
106103
#ifdef __cplusplus
107104
}
108105
#endif

include/zephyr/posix/signal.h

+6-8
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,18 @@ int sigismember(const sigset_t *set, int signo);
7777

7878
typedef int sig_atomic_t; /* Atomic entity type (ANSI) */
7979

80-
typedef union sigval {
80+
union sigval {
8181
int sival_int;
8282
void *sival_ptr;
83-
} sigval;
83+
};
8484

85-
typedef struct sigevent {
85+
struct sigevent {
8686
int sigev_notify;
8787
int sigev_signo;
88-
sigval sigev_value;
89-
void (*sigev_notify_function)(sigval val);
90-
#ifdef CONFIG_PTHREAD_IPC
88+
union sigval sigev_value;
89+
void (*sigev_notify_function)(union sigval val);
9190
pthread_attr_t *sigev_notify_attributes;
92-
#endif
93-
} sigevent;
91+
};
9492

9593
#ifdef __cplusplus
9694
}

lib/posix/timer.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <errno.h>
88
#include <string.h>
99
#include <zephyr/sys/printk.h>
10+
#include <zephyr/posix/signal.h>
1011
#include <zephyr/posix/time.h>
1112

1213
#define ACTIVE 1
@@ -16,8 +17,8 @@ static void zephyr_timer_wrapper(struct k_timer *ztimer);
1617

1718
struct timer_obj {
1819
struct k_timer ztimer;
19-
void (*sigev_notify_function)(sigval val);
20-
sigval val;
20+
void (*sigev_notify_function)(union sigval val);
21+
union sigval val;
2122
struct timespec interval; /* Reload value */
2223
uint32_t reload; /* Reload value in ms */
2324
uint32_t status;

0 commit comments

Comments
 (0)