mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-16 08:04:20 +00:00
add back SIG_IGN, SIG_DFL and friends to posix.nim (#5820)
* add back SIG_IGN, SIG_DFL and friends to posix.nim
accidentally wiped by ce86b4ad78
* move deprecated sig_hold after consts include
This commit is contained in:
committed by
Dominik Picheta
parent
224eec595a
commit
797301ace8
@@ -79,6 +79,9 @@ const
|
||||
DT_SOCK* = 12 ## UNIX domain socket.
|
||||
DT_WHT* = 14
|
||||
|
||||
# Special types
|
||||
type Sighandler = proc (a: cint) {.noconv.}
|
||||
|
||||
# Platform specific stuff
|
||||
|
||||
when defined(linux) and defined(amd64):
|
||||
@@ -86,6 +89,9 @@ when defined(linux) and defined(amd64):
|
||||
else:
|
||||
include posix_other
|
||||
|
||||
# There used to be this name in posix.nim a long time ago, not sure why!
|
||||
{.deprecated: [cSIG_HOLD: SIG_HOLD].}
|
||||
|
||||
when not defined(macosx):
|
||||
proc st_atime*(s: Stat): Time {.inline.} =
|
||||
## Second-granularity time of last access
|
||||
@@ -659,7 +665,7 @@ proc sighold*(a1: cint): cint {.importc, header: "<signal.h>".}
|
||||
proc sigignore*(a1: cint): cint {.importc, header: "<signal.h>".}
|
||||
proc siginterrupt*(a1, a2: cint): cint {.importc, header: "<signal.h>".}
|
||||
proc sigismember*(a1: var Sigset, a2: cint): cint {.importc, header: "<signal.h>".}
|
||||
proc signal*(a1: cint, a2: proc (x: cint) {.noconv.}) {.
|
||||
proc signal*(a1: cint, a2: Sighandler) {.
|
||||
importc, header: "<signal.h>".}
|
||||
proc sigpause*(a1: cint): cint {.importc, header: "<signal.h>".}
|
||||
proc sigpending*(a1: var Sigset): cint {.importc, header: "<signal.h>".}
|
||||
|
||||
@@ -36,6 +36,9 @@ type
|
||||
|
||||
{.deprecated: [TSocketHandle: SocketHandle].}
|
||||
|
||||
# not detected by detect.nim, guarded by #ifdef __USE_UNIX98 in glibc
|
||||
const SIG_HOLD* = cast[SigHandler](2)
|
||||
|
||||
type
|
||||
Timespec* {.importc: "struct timespec",
|
||||
header: "<time.h>", final, pure.} = object ## struct timespec
|
||||
|
||||
@@ -399,6 +399,9 @@ const SS_ONSTACK* = cint(1)
|
||||
const SS_DISABLE* = cint(2)
|
||||
const MINSIGSTKSZ* = cint(2048)
|
||||
const SIGSTKSZ* = cint(8192)
|
||||
const SIG_DFL* = cast[Sighandler](0)
|
||||
const SIG_ERR* = cast[Sighandler](-1)
|
||||
const SIG_IGN* = cast[Sighandler](1)
|
||||
|
||||
# <sys/ipc.h>
|
||||
const IPC_CREAT* = cint(512)
|
||||
|
||||
@@ -414,6 +414,10 @@ var SS_ONSTACK* {.importc: "SS_ONSTACK", header: "<signal.h>".}: cint
|
||||
var SS_DISABLE* {.importc: "SS_DISABLE", header: "<signal.h>".}: cint
|
||||
var MINSIGSTKSZ* {.importc: "MINSIGSTKSZ", header: "<signal.h>".}: cint
|
||||
var SIGSTKSZ* {.importc: "SIGSTKSZ", header: "<signal.h>".}: cint
|
||||
var SIG_HOLD* {.importc: "SIG_HOLD", header: "<signal.h>".}: Sighandler
|
||||
var SIG_DFL* {.importc: "SIG_DFL", header: "<signal.h>".}: Sighandler
|
||||
var SIG_ERR* {.importc: "SIG_ERR", header: "<signal.h>".}: Sighandler
|
||||
var SIG_IGN* {.importc: "SIG_IGN", header: "<signal.h>".}: Sighandler
|
||||
|
||||
# <sys/ipc.h>
|
||||
var IPC_CREAT* {.importc: "IPC_CREAT", header: "<sys/ipc.h>".}: cint
|
||||
|
||||
@@ -119,10 +119,14 @@ proc v(name: string, typ = "cint", no_other = false) =
|
||||
addf(tl,
|
||||
"#ifdef $3\n fprintf(f, \"const $1* = $2(%ld)\\n\", $3);\n#endif\n",
|
||||
n, t, name)
|
||||
else:
|
||||
of "cint", "cshort", "InAddrScalar", "TSa_Family":
|
||||
addf(tl,
|
||||
"#ifdef $3\n fprintf(f, \"const $1* = $2(%d)\\n\", $3);\n#endif\n",
|
||||
n, t, name)
|
||||
else:
|
||||
addf(tl,
|
||||
"#ifdef $3\n fprintf(f, \"const $1* = cast[$2](%d)\\n\", $3);\n#endif\n",
|
||||
n, t, name)
|
||||
|
||||
|
||||
header("<aio.h>")
|
||||
@@ -544,6 +548,11 @@ v("SS_DISABLE")
|
||||
v("MINSIGSTKSZ")
|
||||
v("SIGSTKSZ")
|
||||
|
||||
v("SIG_HOLD", "Sighandler")
|
||||
v("SIG_DFL", "Sighandler")
|
||||
v("SIG_ERR", "Sighandler")
|
||||
v("SIG_IGN", "Sighandler")
|
||||
|
||||
header("<sys/ipc.h>")
|
||||
v("IPC_CREAT")
|
||||
v("IPC_EXCL")
|
||||
|
||||
Reference in New Issue
Block a user