3 ms·
> `socketpair` is useful (and I think portable across platforms that support networking as we know it) Windows is a notable platform not supporting socketpair.
by skissane 2y ago
> `socketpair` is useful (and I think portable across platforms that support networking as we know it)
Windows is a notable platform not supporting socketpair.
Some languages offer socketpair on Windows, e.g. Python, but they are implementing it themselves using TCP loopback connections.
Somewhat irrelevant to this discussion given Windows lacks exec (starting a new executable requires a new process which gets a new PID), and in practice lacks fork too (the low-level NT API has undocumented support for forking, but most of the higher-level APIs get confused by it and break when you use it, making it unusable by the vast majority of applications)
- skissane 2y ago> Somewhat irrelevant to this discussion given Windows lacks exec (starting a new executable requires a new process which gets a new PID), Well, you can do exec() on Windows if you implement it yourself in user space, see e.g. https://github.com/polycone/pe-loader https://github.com/polycone/pe-loader (a bit of a dated project, 32-bit only, but the I believe the same principles apply to 64-bit) Cygwin uses a hack – exec() creates a new Windows process, but every Cygwin process has two PIDs, a Windows PID and a Cygwin PID, so exec() changes the Windows PID but keeps the Cygwin PID the same – so it looks like an exec to Cygwin processes, but just like an ordinary spawn to non-Cygwin processes Less insane approach: if you put most of your code in a DLL, you can unload the DLL and then load a new version of it