summary refs log tree commit diff stats
path: root/lib/posix/posix.nim
Commit message (Collapse)AuthorAgeFilesLines
* NuttX: use accept4 (#21544)Hiroki Noda2023-03-201-1/+1
| | | 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
|
* 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-021-4/+4
|
* fix posix.mq_receive compilation with cpp backend (#20710)n5m2022-11-051-15/+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
* Markdown code blocks migration part 7 (#20547)Andrey Makarov2022-10-121-2/+2
|
* 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
* 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-241-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* 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-231-1/+1
|
* 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-281-1/+1
|
* use single backtick (#17115)flywind2021-02-201-5/+5
|
* fix warning nim nim doc posix (#16995)Timothee Cour2021-02-101-0/+4
|
* stdlib/os: handle symlinks in copy/move functions (#16709)Roman Inflianskas2021-02-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * stdlib/os: handle symlinks in copy/move functions - Added optional `options` argument to `copyFile`, `copyFileToDir`, and `copyFileWithPermissions`. By default, symlinks are followed (copy files symlinks point to). - `copyDir` and `copyDirWithPermissions` copy symlinks as symlinks (instead of skipping them as it was before). - `moveFile` and `moveDir` move symlinks as symlinks (instead of skipping them sometimes as it was before). - Added optional `followSymlinks` argument to `setFilePermissions`. See also: https://github.com/nim-lang/RFCs/issues/319 Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Address comments in #16709 Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Address comments in #16709 (second iteration) Skip symlinks on Windows. Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF) (#15250)Jaremy Creechley2020-08-311-5/+12
| | | | | | | | | | | | | | | | | | | * Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF) Adding FreeRTOS/LwIP to compiler: * adding freertos option * dyncalls for freertos * add freertos to posix os list * adding lwip option Setting up networking FreeRTOS/LwIP Port: * setting up lwip network for freertos * fixing posix / networking for freertos * disable setInheritable for freerots * using lwip for net control items * Fix builds by ignoring lib/posix/posix_freertos_consts.nim similar to lib/posix/posix_other_consts.nim
* Add support for mktemps (#14347)Max Grender-Jones2020-05-251-2/+11
|
* Linux updates (#14170)wltsmrz2020-05-041-0/+2
| | | | | | | | | | | | | | * Add posix_memalign() * Add linux-specific open() flags O_TMPFILE: since Linux 3.11 O_PATH: since Linux 2.6.39 O_NOATIME: since Linux 2.6.8 O_DIRECT: since Linux 2.4.10 * Fix Stat type * Fix POSIX AF_INET* const generation
* Make file descriptors from stdlib non-inheritable by default (#13201)alaviss2020-04-201-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * io: make file descriptors non-inheritable by default This prevents file descriptors/handles leakage to child processes that might cause issues like running out of file descriptors, or potential security issues like leaking a file descriptor to a restricted file. While this breaks backward compatibility, I'm rather certain that not many programs (if any) actually make use of this implementation detail. A new API `setInheritable` is provided for the few that actually want to use this functionality. * io: disable inheritance at file creation time for supported platforms Some platforms provide extension to fopen-family of functions to allow for disabling descriptor inheritance atomically during File creation. This guards against possible leaks when a child process is spawned before we managed to disable the file descriptor inheritance (ie. in a multi-threaded program). * net, nativesockets: make sockets non inheritable by default With this commit, sockets will no longer leak to child processes when you don't want it to. Should solves a lot of "address in use" that might occur when your server has just restarted. All APIs that create sockets in these modules now expose a `inheritable` flag that allow users to toggle inheritance for the resulting sockets. An implementation of `setInheritance()` is also provided for SocketHandle. While atomically disabling inheritance at creation time is supported on Windows, it's only implemented by native winsock2, which is too much for now. This support can be implemented in a future patch. * posix: add F_DUPFD_CLOEXEC This command duplicates file descriptor with close-on-exec flag set. Defined in POSIX.1-2008. * ioselectors_kqueue: don't leak file descriptors File descriptors internally used by ioselectors on BSD/OSX are now shielded from leakage. * posix: add O_CLOEXEC This flag allows file descriptors to be open() with close-on-exec flag set atomically. This flag is specified in POSIX.1-2008 * tfdleak: test for selectors leakage Also simplified the test by using handle-type agnostic APIs to test for validity. * ioselectors_epoll: mark all fd created close-on-exec File descriptors from ioselectors should no longer leaks on Linux. * tfdleak: don't check for selector leakage on Windows The getFd proc for ioselectors_select returns a hardcoded -1 * io: add NoInheritFlag at compile time * io: add support for ioctl-based close-on-exec This allows for the flag to be set/unset in one syscall. While the performance gains might be negliable, we have one less failure point to deal with. * tfdleak: add a test for setInheritable * stdlib: add nimInheritHandles to restore old behaviors * memfiles: make file handle not inheritable by default for posix * io: setInheritable now operates on OS file handle On Windows, the native handle is the only thing that's inheritable, thus we can assume that users of this function will already have the handle available to them. This also allows users to pass down file descriptors from memfiles on Windows with ease, should that be desired. With this, nativesockets.setInheritable can be made much simpler. * changelog: clarify * nativesockets: document setInheritable return value * posix_utils: atomically disable fd inheritance for mkstemp
* posix: add full Haiku support (#13931)alaviss2020-04-091-2/+5
| | | | | | | | | | * posix: add full Haiku support This commit provides a posix_haiku derived from posix_other, with types following Haiku's definition. This fixes cases where the compiler generates type check for the wrong types (ie. checks where generated for an int-derived type but it's actually implemented as an uint instead). * tools/kochdocs: welcome posix_haiku to the blacklist
* Deprecate DCE:on (#13839)Juan Carlos2020-04-021-1/+0
|
* Add sideEffect pragma to importC procs in posix, winlean and time module ↵Tomohiro2020-02-081-66/+66
| | | | | | | | | (#13370) * Add sideEffect pragma to procs in winlean * Add sideEffect pragma to procs in posix * Add test for #13306 * Add sideEffect pragma to procs in times * Fixes #13306
* Add link to posix_utils.html in posix.nim (#13111)Federico Ceratto2020-01-121-1/+4
|
* osx: support nanosecond resolution for file stat (eg ↵Timothee Cour2019-12-041-1/+1
| | | | getLastModificationTime) (#12794)
* Fix #12135 and #12109 (#12137)Euan2019-11-111-0/+2
| | | | | | * Fix #12135 and fix #12109 - fix OpenBSD type defs * Fix Mode definition as in #12132
* introduce csize_t instead of fixing csize (#12497)Arne Döring2019-10-311-0/+6
|
* Fix many broken linksJjp1372019-10-221-1/+1
| | | | | | Note that contrary to what docgen.rst currently says, the ids have to match exactly or else most web browsers will not jump to the intended symbol.
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-1/+1
|
* Fix mode_t posix definitions (fixes #12119) (#12132)pgkos2019-09-061-2/+2
| | | | | * fixes #12119
* make more parts of the stdlib compile with --styleCheck:errorAraq2019-07-101-13/+13
|
* styleCheck: make the compiler and large parts of the stdlib compatible with ↵Araq2019-07-101-24/+30
| | | | --styleCheck:error
* ABI fixes for OSX/BSD; fixes #6860 (#11666)Andreas Rumpf2019-07-061-0/+2
|
* Corrected example shown in documentation (#11654) [ci skip]Akito132019-07-041-1/+1
| | | Used template within example was added to imports.
* Improved posix module, added new posix_utils module (#10723)Federico Ceratto2019-02-281-4/+27
|
* Add a standard Rusage type definition and wait4, getrusage declarations (#10484)c-blake2019-01-291-0/+20
|
* Merge pull request #9862 from zevv/posix-cmsgAndreas Rumpf2018-12-051-0/+6
|\ | | | | Added CMSG_SPACE and CMSG_LEN macros to posix.nim
| * Added CMSG_SPACE and CMSG_LEN macros to posix.nimIco Doornekamp2018-12-041-0/+6
| |
* | removes deprecated T/P typesAraq2018-11-161-1/+0
|/
* inject `sig` from anonymous proc instead of for loopSebastian Schmidt2018-09-241-4/+5
|
* fix `posix.onSignal` example, inject current signal as `s`Vindaar2018-09-241-5/+11
|
* Deprecate 'c', 'C' prefix for octal literals, fixes #8082 (#8178)Vindaar2018-07-031-20/+20
| | | | | | | | | | | | | | | * deprecate `0c`, `0C` prefix for octal literals Deprecates the previously allowed syntax of `0c` and `0C` as a prefix for octal literals to bring the literals in line with the behavior of `parseOct` from parseutils. * add `msgKind` arg to `lexMessageLitNum` for deprecation messages * change literal tests to check all valid integer literals Also adds the `tinvaligintegerlit3` test to test for the (still) invalid `0O` prefix.
* Nintendo switch support (#8069)Joey2018-06-271-32/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | * Add config section for Nintendo Switch * Add compiler configuration for Nintendo Switch and it's CPU * Add specific lib code for Nintendo Switch * Add GC support for Nintendo Switch * Update changelog for Nintendo Switch * Update changelog with more info about fixed paths * Cleaned up GC memory management a bit * Relocate docs for Switch * Rename aarch64NoneElfGcc to nintendoSwitchGCC * Remove armv8a57 * Fix installer.ini * Reuse code in linux and amd64 * Add posix defs for nintendo switch * Add more defined sections for nintendo switch * Remove old comment * Add what's not supported for Nintendo Switch docs * Make nintendoswitch == posix * Remove DEVKITPRO references from nim.cfg * Make PR extccomp changes * Remove Result type alias * Add separate switch consts file * Update docs for nintendo switch * Fix travis errors with undefined consts and add correct wait.h procs
* Use higher time resolution when available in os.nim (#7709)Oscar Nihlgård2018-06-041-2/+20
|