Skip to content

Commit

Permalink
fix Sigaction struct definition (#22160)
Browse files Browse the repository at this point in the history
SigInfo is still wrong (most of its fields are in a union)
  • Loading branch information
arnetheduck authored Jun 27, 2023
1 parent cb40f11 commit 47635d3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/posix/posix_linux_amd64.nim
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ type
sa_mask*: Sigset ## Set of signals to be blocked during execution of
## the signal handling function.
sa_flags*: cint ## Special flags.
sa_sigaction*: proc (x: cint, y: ptr SigInfo, z: pointer) {.noconv.}
sa_restorer: proc() {.noconv.} ## not intended for application use.

Stack* {.importc: "stack_t",
header: "<signal.h>", final, pure.} = object ## stack_t
Expand All @@ -326,9 +326,9 @@ type
SigInfo* {.importc: "siginfo_t",
header: "<signal.h>", final, pure.} = object ## siginfo_t
si_signo*: cint ## Signal number.
si_code*: cint ## Signal code.
si_errno*: cint ## If non-zero, an errno value associated with
## this signal, as defined in <errno.h>.
si_code*: cint ## Signal code.
si_pid*: Pid ## Sending process ID.
si_uid*: Uid ## Real user ID of sending process.
si_addr*: pointer ## Address of faulting instruction.
Expand All @@ -337,6 +337,12 @@ type
si_value*: SigVal ## Signal value.
pad {.importc: "_pad".}: array[128 - 56, uint8]

template sa_sigaction*(v: Sigaction): proc (x: cint, y: ptr SigInfo, z: pointer) {.noconv.} =
cast[proc (x: cint, y: ptr SigInfo, z: pointer) {.noconv.}](v.sa_handler)
proc `sa_sigaction=`*(v: var Sigaction, x: proc (x: cint, y: ptr SigInfo, z: pointer) {.noconv.}) =
v.sa_handler = cast[proc (x: cint) {.noconv.}](x)

type
Nl_item* {.importc: "nl_item", header: "<nl_types.h>".} = cint
Nl_catd* {.importc: "nl_catd", header: "<nl_types.h>".} = pointer

Expand Down

0 comments on commit 47635d3

Please sign in to comment.