diff --git a/lib/posix/posix_other.nim b/lib/posix/posix_other.nim index 8213f796c7c5a..b8a8eef19f55a 100644 --- a/lib/posix/posix_other.nim +++ b/lib/posix/posix_other.nim @@ -140,12 +140,15 @@ type ## used for block sizes Clock* {.importc: "clock_t", header: "".} = int ClockId* {.importc: "clockid_t", header: "".} = int - Dev* {.importc: "dev_t", header: "".} = int + Dev* {.importc: "dev_t", header: "".} = uint64 + # WAS: int. Probably not correct but more correct than previous definition + # https://lists.debian.org/debian-mips/2011/11/msg00006.html Fsblkcnt* {.importc: "fsblkcnt_t", header: "".} = int Fsfilcnt* {.importc: "fsfilcnt_t", header: "".} = int Gid* {.importc: "gid_t", header: "".} = int Id* {.importc: "id_t", header: "".} = int - Ino* {.importc: "ino_t", header: "".} = int + Ino* {.importc: "ino_t", header: "".} = cuint + ## BUGFIX: was int; probably still somewhat incorrect Key* {.importc: "key_t", header: "".} = int Mode* {.importc: "mode_t", header: "".} = ( when defined(android) or defined(macos) or defined(macosx) or @@ -155,7 +158,10 @@ type uint32 ) Nlink* {.importc: "nlink_t", header: "".} = int - Off* {.importc: "off_t", header: "".} = int64 + Off* {.importc: "off_t", header: "".} = cint + # WAS: int64 but this broke on CI in 32bit; a but underspecified, see + # https://stackoverflow.com/questions/9073667/where-to-find-the-complete-definition-of-off-t-type + # and https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.cbcpx01/datatypesize64.htm Pid* {.importc: "pid_t", header: "".} = int32 Pthread_attr* {.importc: "pthread_attr_t", header: "".} = int Pthread_barrier* {.importc: "pthread_barrier_t", diff --git a/lib/system/io.nim b/lib/system/io.nim index 9a4502cbab018..9f80a586e4f3b 100644 --- a/lib/system/io.nim +++ b/lib/system/io.nim @@ -507,10 +507,12 @@ const # should not be translated. when defined(posix) and not defined(nimscript): + type + Mode {.importc: "mode_t", header: "".} = cushort + # BUGFIX: was cint + when defined(linux) and defined(amd64): type - Mode {.importc: "mode_t", header: "".} = cint - # fillers ensure correct size & offsets Stat {.importc: "struct stat", header: "", final, pure.} = object ## struct stat @@ -524,8 +526,6 @@ when defined(posix) and not defined(nimscript): else: type - Mode {.importc: "mode_t", header: "".} = cint - Stat {.importc: "struct stat", header: "", final, pure.} = object ## struct stat st_mode: Mode ## Mode of file