Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

siginfo_t: si_pid, si_status on OpenBSD/NetBSD #3397

Closed
LunarLambda opened this issue Oct 20, 2023 · 0 comments · Fixed by #3400
Closed

siginfo_t: si_pid, si_status on OpenBSD/NetBSD #3397

LunarLambda opened this issue Oct 20, 2023 · 0 comments · Fixed by #3400
Labels
C-API-request Category: API request

Comments

@LunarLambda
Copy link

POSIX defines the following fields on siginfo_t link:

int           si_signo  Signal number. 
int           si_code   Signal code. 
int           si_errno  If non-zero, an errno value associated with 
                        this signal, as described in <errno.h>. 
pid_t         si_pid    Sending process ID. 
uid_t         si_uid    Real user ID of sending process. 
void         *si_addr   Address of faulting instruction. 
int           si_status Exit value or signal. 
long          si_band   Band event for SIGPOLL. 
union sigval  si_value  Signal value.

Of particular interest to me are si_signo, si_code (which are already exposed everywhere), as well as si_pid and si_status. These allow asynchronously receiving the exit status of a child process via SIGCHLD.

However, on x86_64-unknown-netbsd (documented here) and x86_64-unknown-openbsd (undocumented but exists here) , these fields are not exposed in any way. on x86_64-unknown-linux-gnu they are exposed as unsafe methods, and on x86_64-unknown-freebsd, as regular struct fields and unsafe methods.

I understand that this is due to some implementations choosing to use unions, or having different struct field orders. It would be very helpful if there was a consistent, portable way to access them, or at the very least, expose them on those two targets.

@LunarLambda LunarLambda added the C-API-request Category: API request label Oct 20, 2023
devnexen added a commit to devnexen/libc that referenced this issue Oct 21, 2023
devnexen added a commit to devnexen/libc that referenced this issue Oct 21, 2023
bors added a commit that referenced this issue Nov 2, 2023
netbsd/openbsd adding more accessors to siginfo_t.

close #3397
@bors bors closed this as completed in ed7c9e8 Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-API-request Category: API request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant