summary refs log tree commit diff stats
path: root/lib/posix/posix.nim
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* remove dead code elimination option (#7669)Jacek Sieka2018-04-231-4/+4
|
* Move RLimit and getrlimit to posix.nim and add setrlimit to easily limit FD ↵aguspiza2018-04-121-0/+16
| | | | allocation (#7564)
* Better times module (#6552)GULPF2017-12-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * First work on better timezones * Update tests to new api. Removed tests for checking that `isDst` was included when formatting, since `isDst` no longer affects utc offset (the entire utc offset is stored directly in `utcOffset` instead). * Deprecate getLocaltime & getGmTime * Add `now()` as a shorthand for GetTIme().inZone(Local) * Add FedericoCeratto's timezone tests (#6548) * Run more tests in all timezones * Make month enum start at 1 instead of 0 * Deprecate getDayOfWeekJulian * Fix issues with gc safety * Rename TimeInfo => DateTime * Fixes #6465 * Improve isLeapYear * FIx handling negative adjTime * Cleanup: - deprecated toSeconds and fromSeconds, added fromUnix and toUnix instead (that returns int64 instead of float) - added missing doc comments - removed some unnecessary JS specific implementations * Fix misstake in JS `-` for Time * Update usage of TimeEffect * Removed unecessary use of `difftime` * JS fix for local tz * Fix subtraction of months * Fix `days` field in `toTimeInterval` * Style and docs * Fix getDayOfYear for real this time... * Fix handling of adding/subtracting time across dst transitions * Fix some bad usage of the times module in the stdlib * Revert to use proper time resoultion for seeding in random.nim * Move deprecated procs to bottom of file * Always use `epochTime` in `randomize` * Remove TimeInterval normalization * Fixes #6905 * Fix getDayOfWeek for year < 1 * Export toEpochDay/fromEpochDay and change year/month/monthday order * Add asserts for checking that the monthday is valid * Fix some remaining ambiguous references to `Time` * Fix ambiguous reference to Time
* Introduce first class support for Android (#5772)Fredrik Høisæther Rasch2017-08-061-1/+1
|
* add back SIG_IGN, SIG_DFL and friends to posix.nim (#5820)Jacek Sieka2017-05-161-1/+7
| | | | | | | | * add back SIG_IGN, SIG_DFL and friends to posix.nim accidentally wiped by ce86b4ad78aae11f62c50e4f46e8ab2a124356b4 * move deprecated sig_hold after consts include
* WIFSIGNALED means process has exited too (with a bang!) (#5678)Jacek Sieka2017-04-271-9/+0
|
* Posix from detect (#5697)Jacek Sieka2017-04-121-1760/+19
| | | | | | | | | | * 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
* Proper fix for osproc.nim on Android (#5646)Eugene Kabanov2017-04-021-3/+7
|
* Fix wrong value range of ntohs ... (#5390)wt2017-03-311-4/+4
|
* Fix posix.nim `dirent` structure to be more compatible with OSes. (#5623)Eugene Kabanov2017-03-291-2/+7
|
* Fix #5550 (#5553)Ryan Gonzalez2017-03-181-1/+1
|
* Use old approach for Mac OSX which, as of 2016, does not yet support POSIXCharles Blake2017-02-071-12/+18
| | | | high-resolution file times.
* Move Timespec up, use in Stat for st_?tim and define accessors for the secondsCharles Blake2017-02-071-7/+18
| | | | portion of the Timespec.
* posix.nim: make new sigaction wrapper compatible with C++Andreas Rumpf2017-01-201-1/+1
|
* posix.nim add 'sigaction' with 3rd nil parameterAndreas Rumpf2017-01-191-0/+4
|
* posix: add INADDR_LOOPBACKSimon Ruderich2016-09-171-0/+2
|
* posix: add mkstempSimon Ruderich2016-09-171-0/+6
|
* expr and stmt are now deprecatedAndreas Rumpf2016-07-301-1/+1
|
* prepare Nim codebase for upcoming parser changesAndreas Rumpf2016-07-151-6/+6
|
* Added 'android4' define support that declares a different gethostbyaddr. ↵Ruslan Mustakov2016-06-221-2/+6
| | | | Fixes #4376
* Fix android compile time errortormund2016-06-071-1/+7
|
* Merge branch 'unix-sockets' of https://github.com/girvo/Nim into ↵Dominik Picheta2016-05-301-0/+13
|\ | | | | | | girvo-unix-sockets
| * net.nim: add support for Unix socketsMichał Zieliński2015-10-281-0/+13
| |