Skip to content

Compiler issue from siginfo_t, waitid, ... #7512

Description

@MichaelChirico

#7428 introduced some higher compiler requirements than 1.17.0:

data.table/src/utils.c

Lines 688 to 695 in e455714

int *ppids = INTEGER(pids);
R_xlen_t len = xlength(pids);
SEXP ret = allocVector(LGLSXP, len);
int *pret = LOGICAL(ret);
siginfo_t info;
for (R_xlen_t i = 0; i < len; ++i)
pret[i] = waitid(P_PID, ppids[i], &info, WCONTINUED | WEXITED | WNOHANG | WNOWAIT | WSTOPPED) == 0;
return ret;

I get these compiler errors:

src/utils.c:692:3: error: use of undeclared identifier 'siginfo_t'
  692 |   siginfo_t info;
      |   ^~~~~~~~~
src/utils.c:694:15: error: call to undeclared function 'waitid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  694 |     pret[i] = waitid(P_PID, ppids[i], &info, WCONTINUED | WEXITED | WNOHANG | WNOWAIT | WSTOPPED) == 0;
      |               ^
src/utils.c:694:15: note: did you mean 'waitpid'?
.../sys/wait.h:111:16: note: 'waitpid' declared here
  111 | extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
      |                ^
src/utils.c:694:22: error: use of undeclared identifier 'P_PID'
  694 |     pret[i] = waitid(P_PID, ppids[i], &info, WCONTINUED | WEXITED | WNOHANG | WNOWAIT | WSTOPPED) == 0;
      |                      ^~~~~
src/utils.c:694:40: error: use of undeclared identifier 'info'
  694 |     pret[i] = waitid(P_PID, ppids[i], &info, WCONTINUED | WEXITED | WNOHANG | WNOWAIT | WSTOPPED) == 0;
      |                                        ^~~~
src/utils.c:694:46: error: use of undeclared identifier 'WCONTINUED'
  694 |     pret[i] = waitid(P_PID, ppids[i], &info, WCONTINUED | WEXITED | WNOHANG | WNOWAIT | WSTOPPED) == 0;
      |                                              ^~~~~~~~~~
src/utils.c:694:59: error: use of undeclared identifier 'WEXITED'
  694 |     pret[i] = waitid(P_PID, ppids[i], &info, WCONTINUED | WEXITED | WNOHANG | WNOWAIT | WSTOPPED) == 0;
      |                                                           ^~~~~~~
src/utils.c:694:79: error: use of undeclared identifier 'WNOWAIT'
  694 |     pret[i] = waitid(P_PID, ppids[i], &info, WCONTINUED | WEXITED | WNOHANG | WNOWAIT | WSTOPPED) == 0;
      |                                                                               ^~~~~~~
src/utils.c:694:89: error: use of undeclared identifier 'WSTOPPED'
  694 |     pret[i] = waitid(P_PID, ppids[i], &info, WCONTINUED | WEXITED | WNOHANG | WNOWAIT | WSTOPPED) == 0;
      |                                                                                         ^~~~~~~~
8 errors generated.

I fixed it by changing -std=c11 to -std=gnu99, but this is a (mildly) breaking change. Can it be avoided? Or can we add more header guards to work around this / improve the mode of failure?

Activity

  1. added this to the 1.18.2 milestone on Dec 24, 2025
  2. aitap commented on Dec 24, 2025

    @aitap
    Member
  3. MichaelChirico commented on Dec 24, 2025

    @MichaelChirico
    MemberAuthor

    Indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions