Skip to content

Commit 24db03b

Browse files
committed
init
1 parent c3f64fb commit 24db03b

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

lib/posix/posix.nim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ else:
136136
## Nanosecond-granularity time of last data modification.
137137
result.tv_sec = s.st_ctime
138138

139+
proc `and`*(x, y: Mode): Mode {.borrow.}
140+
proc `or`*(x, y: Mode): Mode {.borrow.}
141+
proc `==`*(x, y: Mode): bool {.borrow.}
142+
139143
when hasAioH:
140144
proc aio_cancel*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".}
141145
proc aio_error*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".}

lib/posix/posix_haiku.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ type
157157
Mode* {.importc: "mode_t", header: "<sys/types.h>".} = (
158158
when defined(android) or defined(macos) or defined(macosx) or
159159
(defined(bsd) and not defined(openbsd) and not defined(netbsd)):
160-
uint16
160+
distinct uint16
161161
else:
162-
uint32
162+
distinct uint32
163163
)
164164
Nlink* {.importc: "nlink_t", header: "<sys/types.h>".} = int32
165165
Off* {.importc: "off_t", header: "<sys/types.h>".} = int64

lib/posix/posix_linux_amd64.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ type
144144
Id* {.importc: "id_t", header: "<sys/types.h>".} = cuint
145145
Ino* {.importc: "ino_t", header: "<sys/types.h>".} = culong
146146
Key* {.importc: "key_t", header: "<sys/types.h>".} = cint
147-
Mode* {.importc: "mode_t", header: "<sys/types.h>".} = uint32
147+
Mode* {.importc: "mode_t", header: "<sys/types.h>".} = distinct uint32
148148
Nlink* {.importc: "nlink_t", header: "<sys/types.h>".} = culong
149149
Off* {.importc: "off_t", header: "<sys/types.h>".} = clong
150150
Pid* {.importc: "pid_t", header: "<sys/types.h>".} = cint

lib/posix/posix_macos_amd64.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ type
135135
Key* {.importc: "key_t", header: "<sys/types.h>".} = int
136136
Mode* {.importc: "mode_t", header: "<sys/types.h>".} = (
137137
when defined(openbsd) or defined(netbsd):
138-
uint32
138+
distinct uint32
139139
else:
140-
uint16
140+
distinct uint16
141141
)
142142
Nlink* {.importc: "nlink_t", header: "<sys/types.h>".} = uint16
143143
Off* {.importc: "off_t", header: "<sys/types.h>".} = int64

lib/posix/posix_nintendoswitch.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ type
123123
Id* {.importc: "id_t", header: "<sys/types.h>".} = cuint
124124
Ino* {.importc: "ino_t", header: "<sys/types.h>".} = culong
125125
Key* {.importc: "key_t", header: "<sys/types.h>".} = cint
126-
Mode* {.importc: "mode_t", header: "<sys/types.h>".} = uint16
126+
Mode* {.importc: "mode_t", header: "<sys/types.h>".} = distinct uint16
127127
Nlink* {.importc: "nlink_t", header: "<sys/types.h>".} = culong
128128
Off* {.importc: "off_t", header: "<sys/types.h>".} = clong
129129
Pid* {.importc: "pid_t", header: "<sys/types.h>".} = cint

lib/posix/posix_openbsd_amd64.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ type
142142
Id* {.importc: "id_t", header: "<sys/types.h>".} = int
143143
Ino* {.importc: "ino_t", header: "<sys/types.h>".} = int
144144
Key* {.importc: "key_t", header: "<sys/types.h>".} = int
145-
Mode* {.importc: "mode_t", header: "<sys/types.h>".} = uint32
145+
Mode* {.importc: "mode_t", header: "<sys/types.h>".} = distinct uint32
146146
Nlink* {.importc: "nlink_t", header: "<sys/types.h>".} = uint32
147147
Off* {.importc: "off_t", header: "<sys/types.h>".} = int64
148148
Pid* {.importc: "pid_t", header: "<sys/types.h>".} = int32

lib/posix/posix_other.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ type
160160
Mode* {.importc: "mode_t", header: "<sys/types.h>".} = (
161161
when defined(android) or defined(macos) or defined(macosx) or
162162
(defined(bsd) and not defined(openbsd) and not defined(netbsd)):
163-
uint16
163+
distinct uint16
164164
else:
165-
uint32
165+
distinct uint32
166166
)
167167
Nlink* {.importc: "nlink_t", header: "<sys/types.h>".} = int
168168
Off* {.importc: "off_t", header: "<sys/types.h>".} = int64

lib/std/private/osdirs.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,23 +362,23 @@ proc rawCreateDir(dir: string): bool {.noWeirdTarget.} =
362362
# This is a thin wrapper over mkDir (or alternatives on other systems),
363363
# so in case of a pre-existing path we don't check that it is a directory.
364364
when defined(solaris):
365-
let res = mkdir(dir, 0o777)
365+
let res = mkdir(dir, Mode(0o777))
366366
if res == 0'i32:
367367
result = true
368368
elif errno in {EEXIST, ENOSYS}:
369369
result = false
370370
else:
371371
raiseOSError(osLastError(), dir)
372372
elif defined(haiku):
373-
let res = mkdir(dir, 0o777)
373+
let res = mkdir(dir, Mode(0o777))
374374
if res == 0'i32:
375375
result = true
376376
elif errno == EEXIST or errno == EROFS:
377377
result = false
378378
else:
379379
raiseOSError(osLastError(), dir)
380380
elif defined(posix):
381-
let res = mkdir(dir, 0o777)
381+
let res = mkdir(dir, Mode(0o777))
382382
if res == 0'i32:
383383
result = true
384384
elif errno == EEXIST:

0 commit comments

Comments
 (0)