CLOEXEC on old Linux kernel.

2022-05-10 Thread shirleyquirk
If whatever is opening the socket is setting, CLOEXEC it doesn't expect to have to close the socket (see [here`](https://github.com/nim-lang/Nim/blob/927978345bbf57631828287850eda13b82277eb7/lib/pure/asyncdispatch.nim#L1585) so I don't think setting it to 0 will be enough

CLOEXEC on old Linux kernel.

2022-05-10 Thread AlexKotik
After reading some Nim code from stdlib, I think I can get away by defining SOCK_CLOEXEC to 0. What do you think? I could pass -DSOCK_CLOEXEC=0 to a C compiler, but I was thinking if I could do it using Nim. I've created fixups.nim file with: > {. emit(""" > > #ifndef SOCK_CLOEXEC > #defin

CLOEXEC on old Linux kernel.

2022-05-05 Thread cblake
BTW, if you are hacking/replacing `posix.nim` then you may also want to know about the `patchFile` construct for `myModule.nims`.

CLOEXEC on old Linux kernel.

2022-05-05 Thread shirleyquirk
It looks like asyncdispatch checks to see if `accept4` is declared, and only then uses SOCK_CLOEXEC. I'd try editing posix.nim [here](https://github.com/nim-lang/Nim/blob/927978345bbf57631828287850eda13b82277eb7/lib/posix/posix.nim#L921) and adding another guard, like (defined(li

CLOEXEC on old Linux kernel.

2022-05-03 Thread AlexKotik
Hello. I'm trying to make async sockets work on old embedded system with an old Linux kernel (2.4 brunch) and SOCK_CLOEXEC/O_CLOEXEC appeared in 2.6 brunch according to manuals. Nativesockets in Nim are using CLOEXEC internally when creating a socket. I'd like to use asyncnet for async sockets a