It looks like asyncdispatch checks to see if accept4 is declared, and only then uses SOCK_CLOEXEC.
I'd try editing posix.nim here and adding another guard, like
(defined(linux) and not defined(ancient_linux)) or defined(bsd):
then pass in --define:ancient_linux when you compile
Similar changes might need to be made in nativesockets.nim
{. emit("""
- #ifndef SOCK_CLOEXEC
- #define SOCK_CLOEXEC 0
#endif """) .}
And then added --include:fixups.nim to the generation command, but for some reason the emmitted code isn't added to the to top of C files generated. Maybe I'm doing something wrong here? I thought that --include parameter includes code to all modules, including stdlib, isn't that so?