hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 8372060bbdb465fcb849b4441e9491b4bc2c9b3d
parent a0efbe96bd9fa845c1d61ec405fe0d65d86bc72a
Author: Alexey Yerin <yyp@disroot.org>
Date:   Sun,  3 Sep 2023 16:23:43 +0300

unix::signal::siginfo: Add most options specified by POSIX

Signed-off-by: Alexey Yerin <yyp@disroot.org>

Diffstat:
Munix/signal/+freebsd.ha | 10++++++++--
Munix/signal/+linux.ha | 17+++++++++++++++--
2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/unix/signal/+freebsd.ha b/unix/signal/+freebsd.ha @@ -181,8 +181,6 @@ export fn sigset_member(set: *sigset, item: sig) bool = { // Provides additional information about signal deliveries. Only the members // defined by POSIX are available here; cast to [[rt::siginfo]] to access // non-portable members. -// -// TODO: Expand this with more portable options export type siginfo = union { struct { // The signal number being delivered. @@ -192,6 +190,14 @@ export type siginfo = union { errno: rt::errno, // The signal code, if any. code: code, + // Process ID of the sender. + pid: int, + // Real user ID of the sending process. + uid: uint, + // Exit value or signal. + status: int, + // Address of the faulting instruction. + addr: *opaque, }, // Pads the structure out to the length used by the kernel; do not use. _si_pad: [128 - 3 * size(int)]u8, diff --git a/unix/signal/+linux.ha b/unix/signal/+linux.ha @@ -185,8 +185,6 @@ export fn sigset_member(set: *sigset, item: sig) bool = { // Provides additional information about signal deliveries. Only the members // defined by POSIX are available here; cast to [[rt::siginfo]] to access // non-portable members. -// -// TODO: Expand this with more portable options export type siginfo = union { struct { // The signal number being delivered. @@ -196,6 +194,21 @@ export type siginfo = union { errno: rt::errno, // The signal code, if any. code: code, + + union { + struct { + // Process ID of the sender. + pid: int, + // Real user ID of the sending process. + uid: uint, + // Exit value or signal. + status: int, + }, + struct { + // Address of the faulting instruction. + addr: *opaque, + }, + }, }, // Pads the structure out to the length used by the kernel; do not use. _si_pad: [128 - 3 * size(int)]u8,