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

Make std/posix type names consistent; fixes #22989 #23130

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions lib/posix/posix.nim
Original file line number Diff line number Diff line change
Expand Up @@ -744,11 +744,11 @@ proc time*(a1: var Time): Time {.importc, header: "<time.h>", sideEffect.}
proc timer_create*(a1: ClockId, a2: var SigEvent,
a3: var Timer): cint {.importc, header: "<time.h>".}
proc timer_delete*(a1: Timer): cint {.importc, header: "<time.h>".}
proc timer_gettime*(a1: Timer, a2: var Itimerspec): cint {.
proc timer_gettime*(a1: Timer, a2: var ItimerSpec): cint {.
importc, header: "<time.h>".}
proc timer_getoverrun*(a1: Timer): cint {.importc, header: "<time.h>".}
proc timer_settime*(a1: Timer, a2: cint, a3: var Itimerspec,
a4: var Itimerspec): cint {.importc, header: "<time.h>".}
proc timer_settime*(a1: Timer, a2: cint, a3: var ItimerSpec,
a4: var ItimerSpec): cint {.importc, header: "<time.h>".}
proc tzset*() {.importc, header: "<time.h>".}


Expand Down Expand Up @@ -783,46 +783,46 @@ proc bsd_signal*(a1: cint, a2: proc (x: pointer) {.noconv.}) {.
proc kill*(a1: Pid, a2: cint): cint {.importc, header: "<signal.h>", sideEffect.}
proc killpg*(a1: Pid, a2: cint): cint {.importc, header: "<signal.h>", sideEffect.}
proc pthread_kill*(a1: Pthread, a2: cint): cint {.importc, header: "<signal.h>".}
proc pthread_sigmask*(a1: cint, a2, a3: var Sigset): cint {.
proc pthread_sigmask*(a1: cint, a2, a3: var SigSet): cint {.
importc, header: "<signal.h>".}
proc `raise`*(a1: cint): cint {.importc, header: "<signal.h>".}
proc sigaction*(a1: cint, a2, a3: var Sigaction): cint {.
proc sigaction*(a1: cint, a2, a3: var SigAction): cint {.
importc, header: "<signal.h>".}

proc sigaction*(a1: cint, a2: var Sigaction; a3: ptr Sigaction = nil): cint {.
proc sigaction*(a1: cint, a2: var SigAction; a3: ptr SigAction = nil): cint {.
importc, header: "<signal.h>".}

proc sigaddset*(a1: var Sigset, a2: cint): cint {.importc, header: "<signal.h>".}
proc sigaddset*(a1: var SigSet, a2: cint): cint {.importc, header: "<signal.h>".}
proc sigaltstack*(a1, a2: var Stack): cint {.importc, header: "<signal.h>".}
proc sigdelset*(a1: var Sigset, a2: cint): cint {.importc, header: "<signal.h>".}
proc sigemptyset*(a1: var Sigset): cint {.importc, header: "<signal.h>".}
proc sigfillset*(a1: var Sigset): cint {.importc, header: "<signal.h>".}
proc sigdelset*(a1: var SigSet, a2: cint): cint {.importc, header: "<signal.h>".}
proc sigemptyset*(a1: var SigSet): cint {.importc, header: "<signal.h>".}
proc sigfillset*(a1: var SigSet): cint {.importc, header: "<signal.h>".}
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 sigismember*(a1: var SigSet, a2: cint): cint {.importc, header: "<signal.h>".}
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>".}
proc sigprocmask*(a1: cint, a2, a3: var Sigset): cint {.
proc sigpending*(a1: var SigSet): cint {.importc, header: "<signal.h>".}
proc sigprocmask*(a1: cint, a2, a3: var SigSet): cint {.
importc, header: "<signal.h>".}
proc sigqueue*(a1: Pid, a2: cint, a3: SigVal): cint {.
importc, header: "<signal.h>".}
proc sigrelse*(a1: cint): cint {.importc, header: "<signal.h>".}
proc sigset*(a1: int, a2: proc (x: cint) {.noconv.}) {.
importc, header: "<signal.h>".}
proc sigsuspend*(a1: var Sigset): cint {.importc, header: "<signal.h>".}
proc sigsuspend*(a1: var SigSet): cint {.importc, header: "<signal.h>".}

when defined(android):
proc syscall(arg: clong): clong {.varargs, importc: "syscall", header: "<unistd.h>".}
var NR_rt_sigtimedwait {.importc: "__NR_rt_sigtimedwait", header: "<sys/syscall.h>".}: clong
var NSIGMAX {.importc: "NSIG", header: "<signal.h>".}: clong

proc sigtimedwait*(a1: var Sigset, a2: var SigInfo, a3: var Timespec): cint =
proc sigtimedwait*(a1: var SigSet, a2: var SigInfo, a3: var Timespec): cint =
result = cint(syscall(NR_rt_sigtimedwait, addr(a1), addr(a2), addr(a3), NSIGMAX div 8))
else:
proc sigtimedwait*(a1: var Sigset, a2: var SigInfo,
proc sigtimedwait*(a1: var SigSet, a2: var SigInfo,
a3: var Timespec): cint {.importc, header: "<signal.h>".}

when defined(sunos) or defined(solaris):
Expand All @@ -832,9 +832,9 @@ when defined(sunos) or defined(solaris):
# https://www.illumos.org/man/2/sigwait
{.passc: "-D_POSIX_PTHREAD_SEMANTICS".}

proc sigwait*(a1: var Sigset, a2: var cint): cint {.
proc sigwait*(a1: var SigSet, a2: var cint): cint {.
importc, header: "<signal.h>".}
proc sigwaitinfo*(a1: var Sigset, a2: var SigInfo): cint {.
proc sigwaitinfo*(a1: var SigSet, a2: var SigInfo): cint {.
importc, header: "<signal.h>".}

when not defined(nintendoswitch):
Expand Down Expand Up @@ -867,7 +867,7 @@ proc FD_SET*(a1: cint | SocketHandle, a2: var TFdSet) {.
proc FD_ZERO*(a1: var TFdSet) {.importc, header: "<sys/select.h>".}

proc pselect*(a1: cint, a2, a3, a4: ptr TFdSet, a5: ptr Timespec,
a6: var Sigset): cint {.importc, header: "<sys/select.h>".}
a6: var SigSet): cint {.importc, header: "<sys/select.h>".}
proc select*(a1: cint | SocketHandle, a2, a3, a4: ptr TFdSet, a5: ptr Timeval): cint {.
importc, header: "<sys/select.h>".}

Expand All @@ -890,7 +890,7 @@ when hasSpawnH:
proc posix_spawnattr_destroy*(a1: var Tposix_spawnattr): cint {.
importc, header: "<spawn.h>".}
proc posix_spawnattr_getsigdefault*(a1: var Tposix_spawnattr,
a2: var Sigset): cint {.importc, header: "<spawn.h>".}
a2: var SigSet): cint {.importc, header: "<spawn.h>".}
proc posix_spawnattr_getflags*(a1: var Tposix_spawnattr,
a2: var cshort): cint {.importc, header: "<spawn.h>".}
proc posix_spawnattr_getpgroup*(a1: var Tposix_spawnattr,
Expand All @@ -900,12 +900,12 @@ when hasSpawnH:
proc posix_spawnattr_getschedpolicy*(a1: var Tposix_spawnattr,
a2: var cint): cint {.importc, header: "<spawn.h>".}
proc posix_spawnattr_getsigmask*(a1: var Tposix_spawnattr,
a2: var Sigset): cint {.importc, header: "<spawn.h>".}
a2: var SigSet): cint {.importc, header: "<spawn.h>".}

proc posix_spawnattr_init*(a1: var Tposix_spawnattr): cint {.
importc, header: "<spawn.h>".}
proc posix_spawnattr_setsigdefault*(a1: var Tposix_spawnattr,
a2: var Sigset): cint {.importc, header: "<spawn.h>".}
a2: var SigSet): cint {.importc, header: "<spawn.h>".}
proc posix_spawnattr_setflags*(a1: var Tposix_spawnattr, a2: cint): cint {.
importc, header: "<spawn.h>".}
proc posix_spawnattr_setpgroup*(a1: var Tposix_spawnattr, a2: Pid): cint {.
Expand All @@ -917,7 +917,7 @@ when hasSpawnH:
a2: cint): cint {.
importc, header: "<spawn.h>".}
proc posix_spawnattr_setsigmask*(a1: var Tposix_spawnattr,
a2: var Sigset): cint {.importc, header: "<spawn.h>".}
a2: var SigSet): cint {.importc, header: "<spawn.h>".}
proc posix_spawnp*(a1: var Pid, a2: cstring,
a3: var Tposix_spawn_file_actions,
a4: var Tposix_spawnattr,
Expand Down
10 changes: 5 additions & 5 deletions lib/posix/posix_haiku.nim
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ type
tm_wday*: cint ## Day of week [0,6] (Sunday =0).
tm_yday*: cint ## Day of year [0,365].
tm_isdst*: cint ## Daylight Savings flag.
Itimerspec* {.importc: "struct itimerspec", header: "<time.h>",
ItimerSpec* {.importc: "struct itimerspec", header: "<time.h>",
final, pure.} = object ## struct itimerspec
it_interval*: Timespec ## Timer period.
it_value*: Timespec ## Timer expiration.
Expand All @@ -277,7 +277,7 @@ type
## Possibly volatile-qualified integer type of an object that can be
## accessed as an atomic entity, even in the presence of asynchronous
## interrupts.
Sigset* {.importc: "sigset_t", header: "<signal.h>".} = uint64
SigSet* {.importc: "sigset_t", header: "<signal.h>".} = uint64

SigEvent* {.importc: "struct sigevent",
header: "<signal.h>", final, pure.} = object ## struct sigevent
Expand All @@ -291,12 +291,12 @@ type
header: "<signal.h>", final, pure.} = object ## struct sigval
sival_ptr*: pointer ## pointer signal value;
## integer signal value not defined!
Sigaction* {.importc: "struct sigaction",
SigAction* {.importc: "struct sigaction",
header: "<signal.h>", final, pure.} = object ## struct sigaction
sa_handler*: proc (x: cint) {.noconv.} ## Pointer to a signal-catching
## function or one of the macros
## SIG_IGN or SIG_DFL.
sa_mask*: Sigset ## Set of signals to be blocked during execution of
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.}
Expand Down Expand Up @@ -340,7 +340,7 @@ type
final, pure.} = object ## ucontext_t
uc_link*: ptr Ucontext ## Pointer to the context that is resumed
## when this context returns.
uc_sigmask*: Sigset ## The set of signals that are blocked when this
uc_sigmask*: SigSet ## The set of signals that are blocked when this
## context is active.
uc_stack*: Stack ## The stack used by this context.
uc_mcontext*: Mcontext ## A machine-specific representation of the saved
Expand Down
18 changes: 9 additions & 9 deletions lib/posix/posix_linux_amd64.nim
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ type
tm_gmtoff*: clong
tm_zone*: cstring

Itimerspec* {.importc: "struct itimerspec", header: "<time.h>",
ItimerSpec* {.importc: "struct itimerspec", header: "<time.h>",
final, pure.} = object ## struct itimerspec
it_interval*: Timespec ## Timer period.
it_value*: Timespec ## Timer expiration.
Expand All @@ -285,7 +285,7 @@ type
## Possibly volatile-qualified integer type of an object that can be
## accessed as an atomic entity, even in the presence of asynchronous
## interrupts.
Sigset* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object
SigSet* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object
abi: array[1024 div (8 * sizeof(culong)), culong]

SigEvent* {.importc: "struct sigevent",
Expand All @@ -301,12 +301,12 @@ type
header: "<signal.h>", final, pure.} = object ## struct sigval
sival_ptr*: pointer ## pointer signal value;
## integer signal value not defined!
Sigaction* {.importc: "struct sigaction",
SigAction* {.importc: "struct sigaction",
header: "<signal.h>", final, pure.} = object ## struct sigaction
sa_handler*: proc (x: cint) {.noconv.} ## Pointer to a signal-catching
## function or one of the macros
## SIG_IGN or SIG_DFL.
sa_mask*: Sigset ## Set of signals to be blocked during execution of
sa_mask*: SigSet ## Set of signals to be blocked during execution of
## the signal handling function.
sa_flags*: cint ## Special flags.
sa_restorer: proc() {.noconv.} ## not intended for application use.
Expand Down Expand Up @@ -336,9 +336,9 @@ 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.} =
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.}) =
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
Expand Down Expand Up @@ -372,7 +372,7 @@ type
uc_stack*: Stack ## The stack used by this context.
uc_mcontext*: Mcontext ## A machine-specific representation of the saved
## context.
uc_sigmask*: Sigset ## The set of signals that are blocked when this
uc_sigmask*: SigSet ## The set of signals that are blocked when this
## context is active.
# todo fpregds_mem

Expand Down Expand Up @@ -400,8 +400,8 @@ when hasSpawnH:
header: "<spawn.h>", final, pure.} = object
flags: cshort
pgrp: Pid
sd: Sigset
ss: Sigset
sd: SigSet
ss: SigSet
sp: Sched_param
policy: cint
pad: array[16, cint]
Expand Down
10 changes: 5 additions & 5 deletions lib/posix/posix_macos_amd64.nim
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ type
tm_wday*: cint ## Day of week [0,6] (Sunday =0).
tm_yday*: cint ## Day of year [0,365].
tm_isdst*: cint ## Daylight Savings flag.
Itimerspec* {.importc: "struct itimerspec", header: "<time.h>",
ItimerSpec* {.importc: "struct itimerspec", header: "<time.h>",
final, pure.} = object ## struct itimerspec
it_interval*: Timespec ## Timer period.
it_value*: Timespec ## Timer expiration.
Expand All @@ -266,7 +266,7 @@ type
## Possibly volatile-qualified integer type of an object that can be
## accessed as an atomic entity, even in the presence of asynchronous
## interrupts.
Sigset* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object
SigSet* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object

SigEvent* {.importc: "struct sigevent",
header: "<signal.h>", final, pure.} = object ## struct sigevent
Expand All @@ -280,12 +280,12 @@ type
header: "<signal.h>", final, pure.} = object ## struct sigval
sival_ptr*: pointer ## pointer signal value;
## integer signal value not defined!
Sigaction* {.importc: "struct sigaction",
SigAction* {.importc: "struct sigaction",
header: "<signal.h>", final, pure.} = object ## struct sigaction
sa_handler*: proc (x: cint) {.noconv.} ## Pointer to a signal-catching
## function or one of the macros
## SIG_IGN or SIG_DFL.
sa_mask*: Sigset ## Set of signals to be blocked during execution of
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.}
Expand Down Expand Up @@ -341,7 +341,7 @@ type
final, pure.} = object ## ucontext_t
uc_link*: ptr Ucontext ## Pointer to the context that is resumed
## when this context returns.
uc_sigmask*: Sigset ## The set of signals that are blocked when this
uc_sigmask*: SigSet ## The set of signals that are blocked when this
## context is active.
uc_stack*: Stack ## The stack used by this context.
uc_mcontext*: Mcontext ## A machine-specific representation of the saved
Expand Down
8 changes: 4 additions & 4 deletions lib/posix/posix_nintendoswitch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ type
tm_yday*: cint ## Day of year [0,365].
tm_isdst*: cint ## Daylight Savings flag.

Itimerspec* {.importc: "struct itimerspec", header: "<time.h>",
ItimerSpec* {.importc: "struct itimerspec", header: "<time.h>",
final, pure.} = object ## struct itimerspec
it_interval*: Timespec ## Timer period.
it_value*: Timespec ## Timer expiration.
Expand All @@ -260,7 +260,7 @@ type
## Possibly volatile-qualified integer type of an object that can be
## accessed as an atomic entity, even in the presence of asynchronous
## interrupts.
Sigset* {.importc: "sigset_t", header: "<signal.h>", final.} = culong
SigSet* {.importc: "sigset_t", header: "<signal.h>", final.} = culong

SigEvent* {.importc: "struct sigevent",
header: "<signal.h>", final, pure.} = object ## struct sigevent
Expand All @@ -273,12 +273,12 @@ type
sival_int*: cint ## integer signal value
sival_ptr*: pointer ## pointer signal value;

Sigaction* {.importc: "struct sigaction",
SigAction* {.importc: "struct sigaction",
header: "<signal.h>", final, pure.} = object ## struct sigaction
sa_handler*: proc (x: cint) {.noconv.} ## Pointer to a signal-catching
## function or one of the macros
## SIG_IGN or SIG_DFL.
sa_mask*: Sigset ## Set of signals to be blocked during execution of
sa_mask*: SigSet ## Set of signals to be blocked during execution of
## the signal handling function.
sa_flags*: cint ## Special flags.

Expand Down
10 changes: 5 additions & 5 deletions lib/posix/posix_openbsd_amd64.nim
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ type
tm_wday*: cint ## Day of week [0,6] (Sunday =0).
tm_yday*: cint ## Day of year [0,365].
tm_isdst*: cint ## Daylight Savings flag.
Itimerspec* {.importc: "struct itimerspec", header: "<time.h>",
ItimerSpec* {.importc: "struct itimerspec", header: "<time.h>",
final, pure.} = object ## struct itimerspec
it_interval*: Timespec ## Timer period.
it_value*: Timespec ## Timer expiration.
Expand All @@ -265,7 +265,7 @@ type
## Possibly volatile-qualified integer type of an object that can be
## accessed as an atomic entity, even in the presence of asynchronous
## interrupts.
Sigset* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object
SigSet* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object

SigEvent* {.importc: "struct sigevent",
header: "<signal.h>", final, pure.} = object ## struct sigevent
Expand All @@ -279,12 +279,12 @@ type
header: "<signal.h>", final, pure.} = object ## struct sigval
sival_ptr*: pointer ## pointer signal value;
## integer signal value not defined!
Sigaction* {.importc: "struct sigaction",
SigAction* {.importc: "struct sigaction",
header: "<signal.h>", final, pure.} = object ## struct sigaction
sa_handler*: proc (x: cint) {.noconv.} ## Pointer to a signal-catching
## function or one of the macros
## SIG_IGN or SIG_DFL.
sa_mask*: Sigset ## Set of signals to be blocked during execution of
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.}
Expand Down Expand Up @@ -341,7 +341,7 @@ type
final, pure.} = object ## ucontext_t
uc_link*: ptr Ucontext ## Pointer to the context that is resumed
## when this context returns.
uc_sigmask*: Sigset ## The set of signals that are blocked when this
uc_sigmask*: SigSet ## The set of signals that are blocked when this
## context is active.
uc_stack*: Stack ## The stack used by this context.
uc_mcontext*: Mcontext ## A machine-specific representation of the saved
Expand Down
Loading