Skip to content

Commit a325db9

Browse files
utils.c: include <signal.h> for siginfo_t (#7517)
* utils.c: include <signal.h> for siginfo_t POSIX says: > The <signal.h> header shall define the siginfo_t type as a structure So <sys/wait.h> is not enough to see the definition (not just a forward declaration) of siginfo_t. * NEWS entry * Amend NEWS * more robustly define _POSIX_C_SOURCE (h/t Hugh) * tidy up NEWS * -D_POSIX_C_SOURCE=200809L in gitlab CI job for regression test * revert gitlab-ci change --------- Co-authored-by: Michael Chirico <[email protected]> Co-authored-by: Michael Chirico <[email protected]>
1 parent 11a9435 commit a325db9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
6. `rowwiseDT()` now provides a helpful error message when a complex object that is not a list (e.g., a function) is provided as a cell value, instructing the user to wrap it in `list()`, [#7219](https://github.com/Rdatatable/data.table/issues/7219). Thanks @kylebutts for the report and @venom1204 for the fix.
3434

35+
7. Fixed compilation failure like "error: unknown type name 'siginfo_t'" in v1.18.0 in some strict environments, e.g., FreeBSD, where the header file declaring the POSIX function `waitid` does not transitively include the header file defining the `siginfo_t` type, [#7516](https://github.com/rdatatable/data.table/issues/7516). Thanks to @jszhao for the report and @aitap for the fix.
36+
3537
### Notes
3638

3739
1. {data.table} now depends on R 3.5.0 (2018).

src/utils.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#ifndef _WIN32
2-
# define _POSIX_C_SOURCE 200809L // required for POSIX (not standard C) features in is_direct_child e.g. 'siginfo_t'
3-
# include <sys/wait.h>
2+
# if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
3+
# undef _POSIX_C_SOURCE
4+
# define _POSIX_C_SOURCE 200809L // required for POSIX (not standard C) features in is_direct_child e.g. 'siginfo_t'
5+
# endif
6+
# include <signal.h> // siginfo_t
7+
# include <sys/wait.h> // waitid
48
#endif
59

610
#include "data.table.h"

0 commit comments

Comments
 (0)