Posix from detect (#5697)

* refactor posix.nim
* types move to separate files for platform-specifc and generic
("other')
* consts move to separate files that get autogenerated by detect.nim
* proc's stay where they are for now, though in a second stage might
move as well
* fix missing when
This commit is contained in:
Jacek Sieka 2017-04-13 05:10:54 +08:00 • committed by Andreas Rumpf
commit ce86b4ad78
12 changed files with 3438 additions and 3133 deletions

View file

@ -312,7 +312,7 @@ proc setFilePos*(f: AsyncFile, pos: int64) =
## operations. The file's first byte has the index zero.
f.offset = pos
when not defined(windows) and not defined(nimdoc):
let ret = lseek(f.fd.cint, pos, SEEK_SET)
let ret = lseek(f.fd.cint, pos.Off, SEEK_SET)
if ret == -1:
raiseOSError(osLastError())
@ -481,7 +481,8 @@ proc setFileSize*(f: AsyncFile, length: int64) =
(setEndOfFile(f.fd.Handle) == 0):
raiseOSError(osLastError())
else:
if ftruncate(f.fd.cint, length) == -1:
# will truncate if Off is a 32-bit type!
if ftruncate(f.fd.cint, length.Off) == -1:
raiseOSError(osLastError())
proc close*(f: AsyncFile) =