summary refs log tree commit diff stats
path: root/lib/posix/posix_other.nim
Commit message (Collapse)AuthorAgeFilesLines
* fix no net compilation on zephyr (#19399)Jaremy Creechley2022-01-171-6/+10
| | | Co-authored-by: Jaremy J. Creechley <jaremy.creechley@panthalassa.com>
* Add Zephyr Support (#19003)Jaremy Creechley2021-10-241-33/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 single backtick (#17115)flywind2021-02-201-2/+2
|
* Fixing issue #15302 -- lwip doesn't support signals (#15303)Jaremy Creechley2020-09-141-0/+4
| | | | | | | | * 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-311-18/+62
| | | | | | | | | | | | | | | | | | | * 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-221-1/+1
|
* 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.
* change 'iff' to 'if' to stop "corrections" once and for all (#14182)Miran2020-05-011-3/+3
|
* Make file descriptors from stdlib non-inheritable by default (#13201)alaviss2020-04-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Deprecate DCE:on (#13839)Juan Carlos2020-04-021-2/+0
|
* fix several typos in documentation and comments (#12553)Nindaleth2019-10-301-1/+1
|
* Fix mode_t posix definitions (fixes #12119) (#12132)pgkos2019-09-061-1/+7
| | | | | * fixes #12119
* styleCheck fixes [bugfix]Araq2019-07-151-2/+2
|
* make more parts of the stdlib compile with --styleCheck:errorAraq2019-07-101-5/+5
|
* styleCheck: make the compiler and large parts of the stdlib compatible with ↵Araq2019-07-101-1/+7
| | | | --styleCheck:error
* 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
* removes deprecated T/P typesAraq2018-11-161-35/+1
|
* Convert *_family fields to cushortLemonBoy2018-09-191-1/+1
| | | | 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.
* Fix connectUnix/bindUnix with abstract socket pathsLemonBoy2018-09-151-1/+1
| | | | | | | The only way to make this work for both abstract and non-abstract sockets is to send the kernel an incomplete structure. Reported by Epictek on the forum.
* Haiku support for Nim (#8542)alaviss2018-08-141-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * posix_other: Haiku now has spawn.h This is added per https://dev.haiku-os.org/ticket/13446 * posix_other: Add Haiku specific Dirent members * cpuinfo: Add an implementation for Haiku * distros: Add basic Haiku support * encodings: update Haiku support * fenv, math: Haiku now provides libm * times: Add Haiku struct members * ansi_c, osalloc: Add Haiku constants * threads: Add Haiku support * testament: Haiku uses LIBRARY_PATH * nim.cfg: Update Haiku support libnetwork should only be linked if network functions are used * threads: Haiku does not support -pthread switch * tworkingdir: Haiku's env is in /bin * posix_other: add SIGKILLTHR for Haiku * sockets: link with libnetwork on Haiku * coro: correct ucontext.h location http://pubs.opengroup.org/onlinepubs/009696699/basedefs/ucontext.h.html * coro: ucontext backend is not available on Haiku Haiku doesn't provide the <ucontext.h> header, as it was removed from POSIX * coro: fix setjmp backend The compiler does not allow statements after a noreturn function * nativesockets: Haiku doesn't support AI_V4MAPPED * system: hostOS can contains "haiku" * os: add support for Haiku's packagefs packagefs is read-only, but there are writable holes to the underlying file system as well * os: update constant for Haiku
* Use higher time resolution when available in os.nim (#7709)Oscar Nihlgård2018-06-041-5/+5
|
* remove dead code elimination option (#7669)Jacek Sieka2018-04-231-1/+1
|
* Change type of `Timeval.tv_sec` to `posix.Time` (#7646)Oscar Nihlgård2018-04-181-2/+2
|
* Fixes `times` module compilation on cpp backend. (#7004)Dominik Picheta2018-01-031-1/+1
|
* Better times module (#6552)GULPF2017-12-181-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* fixes #6496Andreas Rumpf2017-10-151-1/+1
|
* Android support: put Termux specific dependencies behind a -d:termux switchAndreas Rumpf2017-08-301-2/+2
|
* Introduce first class support for Android (#5772)Fredrik Høisæther Rasch2017-08-061-1/+1
|
* Add mips64 and mips64el CPU platforms (#5866)James Cowgill2017-08-031-1/+2
|
* Genode readdir fix (#6080)Emery Hemingway2017-07-141-1/+1
| | | The Genode readdir is inherited from then FreeBSD libc.
* WIFSIGNALED means process has exited too (with a bang!) (#5678)Jacek Sieka2017-04-271-0/+15
|
* Posix from detect (#5697)Jacek Sieka2017-04-121-0/+613
* 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