summary refs log tree commit diff stats
path: root/lib/posix
Commit message (Collapse)AuthorAgeFilesLines
* Add posix_utils.osReleaseFile (#16452)Juan Carlos2021-01-041-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add posix_utils.osReleaseFile * Update lib/posix/posix_utils.nim Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com> * Update lib/posix/posix_utils.nim Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com> * Add a basic sanity test * Add a basic sanity test * Add a basic sanity test * Add a basic sanity test * https://github.com/nim-lang/Nim/pull/16452#issuecomment-753364096 * Update lib/posix/posix_utils.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Update lib/posix/posix_utils.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Update changelog.md Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fix #12958 (#16565)Roman Inflianskas2021-01-031-18/+29
| | | | | | | | | | Sync between Linux kernel code (header: https://github.com/torvalds/linux/blob/master/tools/include/uapi/linux/sched.h) and the linux module in lib. `CLONE_STOPPED` was marked as deprecated, as it was removed in the Linux kernel upstream. Fixes #12958.
* Revert "fix #15623 (#16009)"Andrey R (cooldome)2020-11-171-1/+1
| | | | This reverts commit 0f7f159a35bc10a43ff15bcb6c20eefdc574138e.
* fix #15623 (#16009)flywind2020-11-171-1/+1
| | | | | | | | | * fix #15623 * add testcase for #15623 * fix * add testcase
* Fixing issue #15302 -- lwip doesn't support signals (#15303)Jaremy Creechley2020-09-142-12/+28
| | | | | | | | * Fixing issue #15302 -- lwip doesn't support signals * Adding test to catch issue #15302 -- lwip/freertos net library don't try to build / run on windows, it'll compile only but not run Fixing issue #15302 -- reworking test to compile on other platforms
* Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF) (#15250)Jaremy Creechley2020-08-313-23/+562
| | | | | | | | | | | | | | | | | | | * 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
* Unsigned iovlen (#15216)wltsmrz2020-08-224-4/+4
|
* Add `iterator inotify_events` which is *almost always* needed logic for (#15152)c-blake2020-08-081-0/+14
| | | | | | | | | | | | | | | | | | | | client code since Linux `inotify` is much like Linux `getdents64`. Expanding on "almost always"..The only time that this `iterator` logic is ***not*** needed on the output of a `read` from inotify fd's is when one passes a length to `read` *guaranteed* to only pass one event struct in the buffer. That unusual circumstance requires (at least!) knowing the length of the delivered filename before an event occurs, and the filename itself is optional for some event types. It is *far* more common to not know lengths in advance which means one passes a buffer big enough for at least one maximum length directory entry (256 bytes) which is then also big enough for *many* "typical" length entries and therefore many events. In such more common scenarios this iterator logic is definitely needed. Further, not using this logic, yet treating the return from read as "the whole answer" can test ok on "thin" event streams (e.g. 1 event per ms), hiding a latent bug of processing only the first event.
* improve epoll docs (#15137)flywind2020-08-011-21/+23
|
* posix_other: add define to force time_t to 64 bit [backport] (#14753)alaviss2020-06-221-1/+6
| | | | | | | | This is a temporary remedy for time_t transition to 64 bit on newer Linux libc (musl >= 1.2.0, glibc >= 2.32). In the future we might want to move away from libc, or figure out a way to reliably detect the real size of C types at compile time, both of which are difficult.
* Add support for mktemps (#14347)Max Grender-Jones2020-05-252-8/+24
|
* Linux updates (#14170)wltsmrz2020-05-043-9/+17
| | | | | | | | | | | | | | * 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
* change 'iff' to 'if' to stop "corrections" once and for all (#14182)Miran2020-05-014-12/+12
|
* Make file descriptors from stdlib non-inheritable by default (#13201)alaviss2020-04-207-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-092-2/+608
| | | | | | | | | | * 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-028-14/+0
|
* Documentation and Code Style inotify (#13836)Juan Carlos2020-04-021-52/+53
|
* Documentation, add more examples (#13825)Juan Carlos2020-04-011-0/+10
|
* Add Documentation (#13811)Juan Carlos2020-03-311-1/+0
| | | | * Add more Docs and runnableExamples
* Add EPOLLEXCLUSIVE (#13718)Hiroki Noda2020-03-211-0/+1
|
* 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-042-2/+7
| | | | getLastModificationTime) (#12794)
* Fix #12135 and #12109 (#12137)Euan2019-11-112-0/+563
| | | | | | * 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-312-8/+14
|
* fix several typos in documentation and comments (#12553)Nindaleth2019-10-302-2/+2
|
* 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-272-2/+2
|
* Fix mode_t posix definitions (fixes #12119) (#12132)pgkos2019-09-065-6/+17
| | | | | * fixes #12119
* styleCheck fixes [bugfix]Araq2019-07-151-3/+3
|
* styleCheck fixes [bugfix]Araq2019-07-151-2/+2
|
* styleCheck fixes [bugfix]Araq2019-07-151-2/+2
|
* there is only one style -- my styleAraq2019-07-101-0/+6
|
* make more parts of the stdlib compile with --styleCheck:errorAraq2019-07-104-26/+26
|
* styleCheck: make the compiler and large parts of the stdlib compatible with ↵Araq2019-07-104-30/+54
| | | | --styleCheck:error
* dynlib: use posix module (#11623)Jacek Sieka2019-07-082-2/+8
|
* ABI fixes for OSX/BSD; fixes #6860 (#11666)Andreas Rumpf2019-07-062-0/+598
|
* Corrected example shown in documentation (#11654) [ci skip]Akito132019-07-041-1/+1
| | | Used template within example was added to imports.
* Additional platform definitions for sparc64 (#11387)John Paul Adrian Glaubitz2019-06-031-1/+1
| | | | | | * lib/posix: Define SO_REUSEPORT for sparc64 as 0x0200 from kernel ABI * lib/system: Add platform support for sparc64
* Make range checks in semConv (#7164)Oscar Nihlgård2019-05-101-1/+1
| | | | | | | | | | | * Remove NaN/Inf/NegInf magic * Make range checks in semConv * fix the failing line * fix `firstOrd` and `lastOrd` * fix `localError` * remove debug comment * Cleanup, fix failing test * make tests green
* Improved posix module, added new posix_utils module (#10723)Federico Ceratto2019-02-282-4/+128
|
* Add a standard Rusage type definition and wait4, getrusage declarations (#10484)c-blake2019-01-291-0/+20
|
* Fix getAddrInfo, add IPPROTO_ICMPV6 Closes #10198Federico Ceratto2019-01-063-0/+3
|
* 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-165-71/+1
|/
* 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
|
* Convert *_family fields to cushortLemonBoy2018-09-195-15/+14
| | | | Fixes #9008
* Fix regression due to type changeLemonBoy2018-09-161-1/+1
| | | | | The change is technically correct but requires too much type juggling and the effort outweighs the gains.