mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 19:02:18 +00:00
fix Sigaction struct definition (#22160)
SigInfo is still wrong (most of its fields are in a union)
(cherry picked from commit 47635d3031)
This commit is contained in:
@@ -309,7 +309,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
|
||||
@@ -325,9 +325,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.
|
||||
@@ -336,6 +336,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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user