summary refs log tree commit diff stats
path: root/lib/posix
Commit message (Collapse)AuthorAgeFilesLines
* add posix uint changes to changelog + fix Nlink, Dev on FreeBSD (#24088)metagn2024-09-092-4/+12
| | | | | | | refs #24078, refs #24076 Since these changes are potentially breaking, add them to changelog, also add Nlink as mentioned in https://github.com/nim-lang/Nim/issues/24076#issuecomment-2337666555.
* fix: InotifyEvent.name should be UncheckedArray[char] (#23413)Tobias Dély2024-09-091-1/+1
|
* fix int32's that should be uint32 on BSD & OSX (#24078)metagn2024-09-092-10/+10
| | | | | | | | | fixes #24076 As described in #24076, misannotating these types causes codegen errors. Sources for the types are https://github.com/openbsd/src/blob/master/sys for BSD and https://opensource.apple.com/source/Libinfo/Libinfo-391/ and [_types.h](https://opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/_types.h.auto.html) for OSX.
* better examples for std/inotify (#23415)Archar Gelod2024-08-141-11/+21
| | | | | | | | | | | | | | | | | Previous example wouldn't run unless `std/posix` was imported and it wasn't mentioned anywhere in the docs. Other changes in the example: - replaced magic number with constant `MaxWatches` . - changed seq buffer to array, because length is already constant + pointer is a bit nicer: `addr seq[0]` vs `addr arr` - added example for getting a `cstring` name value from `InotifyEvent` struct with explicit cast. - added a bit more description to `inotify_init1` (copied from `man inotify(7)`) --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* let `InotifyEvent` type `sizeof`-able (#22958)Derek2023-11-181-1/+2
| | | | Since the `InotifyEvent`s are receive through `read()`, user need the size of the type.
* Fix OSError `errorCode` field is not assigned a value (#22954)握猫猫2023-11-171-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | In this PR, the following changes were made: 1. Replaced `raise newException(OSError, osErrorMsg(errno))` in batches with `raiseOSError(errcode)`. 2. Replaced `newException(OSError, osErrorMsg(errno))` in batches with `newOSError(errcode)`. There are still some places that have not been replaced. After checking, they are not system errors in the traditional sense. ```nim proc dlclose(lib: LibHandle) = raise newException(OSError, "dlclose not implemented on Nintendo Switch!") ``` ```nim if not fileExists(result) and not dirExists(result): # consider using: `raiseOSError(osLastError(), result)` raise newException(OSError, "file '" & result & "' does not exist") ``` ```nim proc paramStr*(i: int): string = raise newException(OSError, "paramStr is not implemented on Genode") ```
* complete std prefixes for stdlib (#22887)ringabout2023-10-305-5/+5
| | | | follow up https://github.com/nim-lang/Nim/pull/22851 follow up https://github.com/nim-lang/Nim/pull/22873
* Add Linux constant SO_BINDTODEVICE (#22468)Emery Hemingway2023-08-142-0/+2
|
* Revert "fix struct stat" (#22171)Andreas Rumpf2023-06-271-1/+0
| | | | | Revert "fix struct stat (#22161)" This reverts commit 4b761295e7ab31412903c02b8fb98f580bf005ca.
* fix Sigaction struct definition (#22160)Jacek Sieka2023-06-271-2/+8
| | | SigInfo is still wrong (most of its fields are in a union)
* fix struct stat (#22161)Jacek Sieka2023-06-271-0/+1
| | | Undo damage of https://github.com/nim-lang/Nim/pull/14170
* add const RLIMIT_STACK (#21772)Qinsi (James) ZHU2023-06-092-0/+2
| | | | | | | * add const RLIMIT_STACK * generate by detect.nim * add generated const for linux-amd64
* NuttX: use posix_spawn for osproc (#21539)Hiroki Noda2023-03-201-5/+5
| | | | | NuttX has standard posix_spawn interface, and can be used with it. * https://nuttx.apache.org/docs/12.0.0/reference/user/01_task_control.html#c.posix_spawn
* NuttX: use accept4 (#21544)Hiroki Noda2023-03-202-2/+2
| | | NuttX supports accept4 since https://github.com/apache/nuttx/commit/48c9d1033659603663f6e35587cf27045a130e0d
* Fix: nintendoswitch compilation (#21368)Dmitry Arkhipenko2023-02-251-2/+6
| | | | | * Fix: make nintendoswitch someGcc, remove symlink support for nintendoswitch, add getAppFilename for nintendoswitch * Fix: use getApplHeuristic on nintendoswitch
* Fix the TODO portion of recently added `posix_fallocate` on OS X. (#21387)c-blake2023-02-221-2/+17
|
* ioselectors_epoll: for NuttX, limit initial numFD to configured value. (#21421)Century Systems2023-02-221-0/+3
| | | | | | | | | | | | | | | | | ioselectors: ioselectors_epoll: for NuttX, limit initial numFD to configured value. In the NuttX build config, there is a setting called "FS_NEPOLL_DESCRIPTORS". -------- config FS_NEPOLL_DESCRIPTORS int "Maximum number of default epoll descriptors for epoll_create1(2)" default 8 ---help--- The maximum number of default epoll descriptors for epoll_create1(2) -------- For NuttX, change the number of fd arrays allocated by newSelector() to that value. Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
* NuttX added supports getrlimit(RLIMIT_NOFILE), so remove NuttX specific ↵Century Systems2023-02-211-3/+0
| | | | | | | codes. (#21385) async: NuttX added supports getrlimit(RLIMIT_NOFILE), so remove NuttX-specific codes. Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
* Add support for NuttX RTOS. (#21372)Century Systems2023-02-162-2/+16
| | | | | | | | | | | | | | | | | | | | | | * Add support for NuttX RTOS. Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp> * lib: pure: asyncdispatch: assign to result. Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp> * lib: std: typedthreads: add support for parameters to adjust Thread Stack Size. Like FreeRTOS/Zephyr, add support for following configurations. -d:nimThreadStackSize=xxxxx -d:nimThreadStackGuard=yyyy Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp> --------- Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
* Fix `closeHandle` bug, add `setFileSize`, make `resize` work on Windows (#21375)c-blake2023-02-151-3/+8
| | | | | | | | | | | | | | * Add general purpose `setFileSize` (unexported for now). Use to simplify `memfiles.open` as well as make robust (via hard allocation, not merely `ftruncate` address space allocation) on systems with `posix_fallocate`. As part of this, fix a bad `closeHandle` return check bug on Windows and add `MemFile.resize` for Windows now that setFileSize makes that easier. * Adapt existing test to exercise newly portable `MemFile.resize`. * Since Apple has never provided `posix_fallocate`, provide a fallback. This is presently written in terms of `ftruncate`, but it can be improved to use `F_PREALLOCATE` instead, as mentioned in a comment.
* minor code cleanups (#21215)Andreas Rumpf2023-01-022-7/+7
|
* Remove deprecated posix.CLONE_STOPPED (#21012)Juan Carlos2022-12-051-1/+1
| | | | | * Remove deprecated CLONE_STOPPED * Remove deprecated CLONE_STOPPED
* fixes ptr to cstring warnings[backport] (#20848)ringabout2022-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix =#13790 ptr char (+friends) should not implicitly convert to cstring * Apply suggestions from code review * first round; compiles on windows * nimPreviewSlimSystem * conversion is unsafe, cast needed * fixes more tests * fixes asyncnet * another try another error * last one * true * one more * why bugs didn't show at once * add `nimPreviewCstringConversion` switch * typo * fixes ptr to cstring warnings[backport] * add fixes Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* fixes nightlies regression; patches for freebsd (#20786)ringabout2022-11-081-0/+12
|
* fix posix.mq_receive compilation with cpp backend (#20710)n5m2022-11-052-24/+41
| | | | | | | | | | | | | | | | | * fix posix.mq_receive compilation with cpp backend * only enable runnableExample on posix * linux, not posix * simplify example * add test * mqueue.h does not exist on MacOS * place test case in own block * drop runnableExamples
* fixes #20526; use `nimPreviewSlimSystem` for documentation build (#20714)ringabout2022-11-012-0/+6
| | | | | | | * fixes #20526; use `nimPreviewSlimSystem` for `koch docs` * fixes documentation errors * fixes remaning issues
* Markdown code blocks migration part 7 (#20547)Andrey Makarov2022-10-122-4/+4
|
* Markdown indented code blocks (#20473)Andrey Makarov2022-10-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | | * Implement Markdown indented code blocks Additional indentation of 4 spaces makes a block an "indented code block" (monospaced text without syntax highlighting). Also `::` RST syntax for code blocks is disabled. So instead of ```rst see:: Some code ``` the code block should be written as ```markdown see: Some code ``` * Migrate RST literal blocks :: to Markdown's ones
* moderate system cleanup & refactor (#20355)metagn2022-09-282-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * system refactor, move out 600 lines * compilation, slice, backwardsindex, misc_num moved out of system * some procs/types moved into arithmetics, basic_types * system no longer depends on syncio * some procs moved around to fit with their surroundings * make exceptions an import, old ops to misc_num * move instantiationInfo back * move back nim version, fix windows echo * include compilation * better docs for imported modules, fix unsigned ops also remove ze, ze64, toU8, toU16, toU32 with nimPreviewSlimSystem * fix terminal * workaround IC test & weird csize bug, changelog * move NimMajor etc back to compilation, rebase for CI * try ic fix * form single `indices`, slim out TaintedString, try fix IC * fix CI, update changelog, addQuitProc * fix CI * try fix CI * actually fix CI finally hopefully * Update lib/system/compilation.nim Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> * update kochdocs * hopefully fix csize uses for slimsystem * fix tquit Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* Fix issue with fields trying to use wrong name (#12655)Peter Munch-Ellingsen2022-09-261-2/+2
| | | | | | | | | | * Fix issue with fields trying to use wrong name * Fix similar issue in winlean * Revert accidental csize change Co-authored-by: Clyybber <darkmine956@gmail.com> Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* Adds missing SEEK_ POSIX constants for FreeRTOS (#20241)jgirvin-venturi2022-08-191-0/+4
|
* epoll: correct mapping [backport] (#20058)Jacek Sieka2022-07-181-5/+14
| | | | | | | * epoll: correct mapping `epoll_data` is a union and `epoll_event` is packed on `amd64` * names
* fix `pthread_mutex_t` size (#20055)Jacek Sieka2022-07-181-1/+1
|
* Remove deprecated posix proc (#19774)Juan Carlos2022-05-081-10/+0
| | | | | * Remove deprecated posix proc that takes wrong argument types * Remove deprecated posix proc that takes wrong argument types
* enable style:usages for stdlib tests [backport: 1.6] (#19715)flywind2022-04-131-1/+1
| | | | | | | | | | | | | | | * enable style:usages for stdlib tests * freeAddrInfo * more tests * importc * bufSize * fix more * => parseSql and renderSql
* correct typos (#19485)flywind2022-02-031-1/+1
|
* move io out of system (#19442)flywind2022-02-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | * move io out of system * fix tests * fix tests * next step * rename to syncio * rename * fix nimscript * comma * fix * fix parts of errors * good for now * fix test
* fix no net compilation on zephyr (#19399)Jaremy Creechley2022-01-171-6/+10
| | | Co-authored-by: Jaremy J. Creechley <jaremy.creechley@panthalassa.com>
* add compile time option for POSIX sigwait on Illumos/Solaris (#19296)BarrOff2022-01-021-0/+7
| | | | | * add compile time option for POSIX sigwait on Illumos/Solaris * fix link to documentation of `sigwait` on Illumos/Solaris
* Various std net improvements (#19132)Jaremy Creechley2021-12-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Variant of that works with raw IpAddresses. - Add doc tests for new net proc's. - Aadd recvFrom impl - Add recvFrom impl -- tweak handling data var - Update lib/pure/net.nim Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com> - cleaning up sendTo args - remove extra connect test - cleaning up sendTo args - fix inet_ntop test - fix test failing - byte len * fix test failing - byte len * debugging odd windows build failure * debugging odd windows build failure * more experiments to figure out the windows failure * try manual assigment on InAddr Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
* Add Zephyr Support (#19003)Jaremy Creechley2021-10-244-37/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Porting Nim to run on Zephyr. Includes changes to `std/net`. Squashed commit of the following: tweaking more memory / malloc things revert back bitmasks tweaking nim to use kernel heap as C malloc doesn't work fixing socket polling on zephyr cleanup getting maximum sockets for process or for rtos'es reorganizing and fixing net for async / system merge netlite changes back into nativesockets merge netlite changes back into nativesockets reverting native sockets back tweaking nim / zephyr network adding option to run 'net-lite' from linux bridging zephyr's max connections fixing net errors fixing compilation with getAddrString fixing compilation with getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... add note regarding incorrect FreeRTOS Sockadd_in fields changing to NIM_STATIC_ASSERT cleaning up the static_assert error messages cleaning up the static_assert error messages setting up static assert ftw! testing compile time asserts reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms finding missing items (issue #18684) fixup posix constants (issue #18684) adding plumbing for zephyr os (issue #18684) adding plumbing for zephyr os (issue #18684) * fixing constant capitalizations * remove extra debug prints and fix TSa_Family/cint issue * remove extra debug prints and fix TSa_Family/cint issue * Porting Nim to run on Zephyr. Includes changes to `std/net`. Squashed commit of the following: tweaking more memory / malloc things revert back bitmasks tweaking nim to use kernel heap as C malloc doesn't work fixing socket polling on zephyr cleanup getting maximum sockets for process or for rtos'es reorganizing and fixing net for async / system merge netlite changes back into nativesockets merge netlite changes back into nativesockets reverting native sockets back tweaking nim / zephyr network adding option to run 'net-lite' from linux bridging zephyr's max connections fixing net errors fixing compilation with getAddrString fixing compilation with getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... add note regarding incorrect FreeRTOS Sockadd_in fields changing to NIM_STATIC_ASSERT cleaning up the static_assert error messages cleaning up the static_assert error messages setting up static assert ftw! testing compile time asserts reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms finding missing items (issue #18684) fixup posix constants (issue #18684) adding plumbing for zephyr os (issue #18684) adding plumbing for zephyr os (issue #18684) * fixing constant capitalizations * remove extra debug prints and fix TSa_Family/cint issue * remove extra debug prints and fix TSa_Family/cint issue * fixing PR issues * Porting Nim to run on Zephyr. Includes changes to `std/net`. Squashed commit of the following: tweaking more memory / malloc things revert back bitmasks tweaking nim to use kernel heap as C malloc doesn't work fixing socket polling on zephyr cleanup getting maximum sockets for process or for rtos'es reorganizing and fixing net for async / system merge netlite changes back into nativesockets merge netlite changes back into nativesockets reverting native sockets back tweaking nim / zephyr network adding option to run 'net-lite' from linux bridging zephyr's max connections fixing net errors fixing compilation with getAddrString fixing compilation with getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... add note regarding incorrect FreeRTOS Sockadd_in fields changing to NIM_STATIC_ASSERT cleaning up the static_assert error messages cleaning up the static_assert error messages setting up static assert ftw! testing compile time asserts reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms finding missing items (issue #18684) fixup posix constants (issue #18684) adding plumbing for zephyr os (issue #18684) adding plumbing for zephyr os (issue #18684) * fixing constant capitalizations * remove extra debug prints and fix TSa_Family/cint issue * remove extra debug prints and fix TSa_Family/cint issue * Remerge * fixing constant capitalizations * remove extra debug prints and fix TSa_Family/cint issue * remove extra debug prints and fix TSa_Family/cint issue * fixing PR issues * fix maxDescriptors on zephyr/freertos * move maxDescriptors to selector.nim -- fixes compile issue * change realloc impl on zephyr to match ansi c behavior * change realloc impl on zephyr to match ansi c behavior * force compileOnly mode for tlwip Co-authored-by: Jaremy J. Creechley <jaremy.creechley@wavebaselabs.com> Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
* use the correct header for TIOCGWINSZ on Solaris (#19037)BarrOff2021-10-221-2/+5
|
* use more `.}` (#18542)flywind2021-07-201-1/+1
|
* deprecate cuchar, don't redefine it (#18505)Andreas Rumpf2021-07-162-7/+7
|
* docs: make inline markup more compatible with Markdown (#18053)Andrey Makarov2021-05-211-1/+1
| | | fixes https://github.com/timotheecour/Nim/issues/739
* fix #17888: remove undefined behavior for posix.open; fix ↵Timothee Cour2021-04-291-1/+5
| | | | | | | | | | | tempfiles.createTempFile (#17889) * fix #17888: remove undefined behavior for posix.open; fix tempfiles.createTempFile * fix for tests/async/tasyncfile.nim * hide mode for now * add notice regarding stability
* remove redundant void return in stdlib (#17464)Timothee Cour2021-03-232-2/+2
|
* Use `.. warning::` (#17320)konsumlamm2021-03-101-6/+6
|
* use lowercase --define switches (#17283)flywind2021-03-071-1/+1
|
* Change stdlib imports to use std prefix in most examples (#17202)Danil Yarantsev2021-02-282-2/+2
|