summary refs log tree commit diff stats
path: root/lib/pure/ioselects
Commit message (Collapse)AuthorAgeFilesLines
* styleCheck: Fix some inconsistent identifiers (#16177)ee72020-12-212-2/+2
|
* attempt to make asynchttpserver better; fixes #15925; [backport:1.0]Araq2020-11-134-10/+10
|
* deinitLock (#15383)flywind2020-09-221-0/+1
| | | | | * deinitLock * minor
* ORC/ARC async progress (#15370)Andreas Rumpf2020-09-201-2/+2
| | | | | | | * ARC/ORC: fixes memory leak for empty seqs that have a non-zero capacity * async: minor refactorings * it helps to finish a refactoring
* async: minor refactorings (#15354)Andreas Rumpf2020-09-181-2/+2
|
* Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF) (#15250)Jaremy Creechley2020-08-311-1/+1
| | | | | | | | | | | | | | | | | | | * 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
* Set O_NONBLOCK flag atomically (#13934)Hiroki Noda2020-04-221-8/+4
| | | | These flags were added in Linux 2.6.27, I'm not sure Nim's minimal support Linux version.
* Make file descriptors from stdlib non-inheritable by default (#13201)alaviss2020-04-202-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* revert stdlib changes which are not required anymoreAndreas Rumpf2020-04-013-9/+5
|
* Hrm, the new errors highlighted some code that seems to be brokenZahary Karadjov2020-04-013-5/+9
| | | | | | New issue: since `Table[A, B]` allocates its backing storage with `newSeq[KeyValuePair[A, B]]`, it's no longer legal to create a table with `not nil` types used as either keys or values.
* fix deprecations and other warnings (#13748)Miran2020-03-251-2/+2
|
* csize => csize_t for sysctlTimothee Cour2020-01-281-5/+5
|
* fixes based on code review by @dom96Ray Imber2019-10-162-4/+4
| | | | | | | | - For clarity: Changed the unregister if statement to use the in operator instead of the set intersection operator in ioselectors_epoll.nim and ioselectors_select.nim. - Fixed unregister of Event.User case on the Android branch.
* Remove unnecessary change to ioselectors_kqueue.nim found by @cheatfate.Ray Imber2019-10-111-2/+2
|
* Fix io slector unregister for windows as well.Ray Imber2019-10-101-1/+1
|
* Additional fix for User key unregister in the KQueue backendRay Imber2019-10-061-1/+1
|
* Test + fix for epoll and kqueue selector modules to properly unregisterRay Imber2019-10-062-3/+3
| | | | event handles that have the key type "User"
* styleCheck fixes [bugfix]Araq2019-07-151-2/+2
|
* there is only one style -- my styleAraq2019-07-101-11/+11
|
* make more parts of the stdlib compile with --styleCheck:errorAraq2019-07-102-4/+4
|
* newruntime for async (#11650)Andreas Rumpf2019-07-051-1/+1
| | | | | | | * fixes overloading resolution for passing owned(Future[string]) to Future[T] * WIP: make --newruntime work with .async * memtracker: make it compile again * make Nimble compile again
* Fixes crashes when asyncdispatch.adjustTimeout returns a negative value. ↵Dominik Picheta2019-05-154-4/+12
| | | | (#11231)
* fixes #11124Andreas Rumpf2019-05-131-2/+2
|
* epoll selector starts with reasonable fd set size (1024) and increases in ↵Ico Doornekamp2019-01-091-3/+19
| | | | powers of two when needed. This prevents the selector to allocate large amounts of memory at startup on systems with a high RLIMIT_NOFILE setting (#10194)
* fixes #7667; underlying issue is that dot calls in generics have no concept ↵Araq2018-10-291-4/+4
| | | | of 'friend' symbols, will be addressed later
* ioselectors_poll: don't pollRemove() if not neededLeorize2018-09-221-2/+3
| | | | pollAdd() is called only if events set isn't empty.
* Genode fixes (#8501)Emery Hemingway2018-08-161-2/+4
| | | | | | | | | | | | | * Genode fixes - wrap strings in "Genode::Cstring" when logging - define SIGABRT for Genode - disable GCC -fstack-protector - use log RPC for fatal messages - add --os:genode build to appveyor - define paramStr and paramCount * Select fixups for Genode POSIX
* OSX: make tioslectors test greenAndreas Rumpf2018-08-061-1/+4
|
* Fixed typo introduced in #8428 that leads to InvalidIdent assertion failure ↵Yuriy Glukhov2018-07-301-1/+1
| | | | (#8464)
* Allow async stdinYuriy Glukhov2018-07-254-48/+42
|
* Move RLimit and getrlimit to posix.nim and add setrlimit to easily limit FD ↵aguspiza2018-04-122-17/+1
| | | | allocation (#7564)
* RLIMIT_NOFILE as posix constJacek Sieka2018-04-012-8/+4
|
* Merge branch 'devel' into async-improvementsDominik Picheta2018-01-172-5/+6
|\
| * Better times module (#6552)GULPF2017-12-182-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* | Merge branch 'devel' into async-improvementsAndreas Rumpf2017-12-111-13/+15
|\|
| * favor 'select' over 'poll' on Genode (#6821)Emery Hemingway2017-12-011-13/+15
| | | | | | The 'poll' of the Genode C runtime is a wrapper over 'select'.
* | Multiple improvements to selectors.Dominik Picheta2017-11-244-13/+45
|/ | | | | | | | * Added ``getFd`` procedure for retrieving the underlying selector's FD. * Selectors module's procedures now accept an ``int`` as well as a ``SocketHandle``. * ReadyKey now contains the error code for Event.Error events.
* Async upcoming (#6585)Dominik Picheta2017-11-224-89/+80
| | | | | | | | | | | | | * Merge upcoming async with current. * Various improvements to selectors (mostly docs). Two changes to highlight: * Renamed ``setEvent`` to ``trigger`` * Reused setBlocking from nativesockets. * Various changes/fixes to asyncdispatch after upcoming merge. * Make some attempts to be compatible with older selectors. * Reuse epoll module in ioselectors_epoll.
* Fixes to support Dragonfly BSD. (#5552)Eugene Kabanov2017-03-171-1/+1
| | | | | | | | | * Fix kqueue.nim and ansi_c.nim to support dragonfly. * Fix ioselectors.nim, threads.nim to support dragonfly. * Fix deprecated dealloc call in tioselectors.nim. * Fix tfsmonitor.nim test to run only on Linux. * Fix osproc.nim return wrong exit codes. * Fix getAppFilename() for dragonfly. * Fix proper exit code handling.
* Fixes for upcoming asyncdispatch and ioselectors. (#5309)Eugene Kabanov2017-02-014-30/+34
|
* One more fix for #5290.cheatfate2017-01-281-8/+11
|
* Fix mistakecheatfate2017-01-271-2/+2
|
* Fix #5290.cheatfate2017-01-274-53/+58
| | | | Some cosmetic changes.
* oops.cheatfate2017-01-261-0/+1
|
* Fix changes table must be SharedArray when hasThreadSupport.cheatfate2017-01-261-13/+50
|
* Fix #5128, #5184. (#5214)Eugene Kabanov2017-01-164-347/+507
| | | | | | | | | | | | * Fix #5128, #5184. Removed flush() procedure from ioselectors.nim Changed methods of work with application-driven data * Make cache switch for kqueue, update test for it. * Fix registerProcess bug returns wrong id. Fix tupcoming_async test to compile with upcoming again. Change socket() as unique identifier to dup(socket) as unique identifier.
* Support android compilation of ioselectors.cheatfate2016-12-051-135/+185
|
* Fix #4928cheatfate2016-10-221-5/+5
|
* Add support for kqueue's EVFILT_VNODE (filesystem monitoring), and add test ↵cheatfate2016-09-241-0/+41
| | | | for it.
* Fix 32bit architecture problems with SelectEvent.cheatfate2016-08-313-5/+5
|