5 ms·
> the Linux fork syscall has no documented equivalent for Windows Emphasis is mine. I wonder if this is something that cygwin could (ab)use. Also I wonder why
by kevincox 10y ago
> the Linux fork syscall has no documented equivalent for Windows
Emphasis is mine. I wonder if this is something that cygwin could (ab)use. Also I wonder why they would need this undocumented call.
- xorblurb 10y agoCygwin is layered above Win32. Win32 has no provision to nicely handle forks. So even if there was an NT API fork syscall (I'm don't think there is on Windows 10, WSL does not use the NT API, there is not any more Posix/SFU/{Whatever Unix NT classic subsys of the day} as far as I know), this would not go anywhere.
- pcwalton 10y ago> So even if there was an NT API fork syscall You can do it with NtCreateProcess: https://groups.google.com/d/msg/microsoft.public.win32.programmer.kernel/ejtHCZmdyaI/k0D0Jinx9KwJ https://groups.google.com/d/msg/microsoft.public.win32.progr... (The Win32 userland won't understand what you did, but you can still do it.)
- xorblurb 10y agoWell, you can do it on some versions of Windows. On Windows 10, and even future version of Windows 10, not so sure...
- lmm 10y agoWindows 10 is still windows NT. The NT native API is widely used these days. It would be a huge departure for MS to stop supporting it in future versions of windows.
- xorblurb 10y agoMost parts of the NT API have never been officially documented, officially supported, stable (in the "won't change" meaning), and the tiny parts that have actually been documented come with caveats that they are susceptible to change. Supporting fork through the NT API forever makes no sense if there are no users anymore. They could continue to do it for no specific reason, just because fork is internally needed by WSL for example, and so because it is easy to export the capability through the NT API, but I really don't see why they would necessarily do that.
- lmm 10y agoMS has historically maintained compatibility with even undocumented APIs. Of course that could change.
- rossy 10y agoCygwin programs technically run under the Win32 subsystem, but they're not that cleanly layered. The runtime calls into a lot of Nt* functions, including undocumented ones. midipix (which another commenter mentioned) is another Unix-like environment for Windows that also runs under the Win32 subsystem, and apparently it has successfully implemented a real copy-on-write fork() on top of undocumented NT syscalls, so it's definitely possible.
- wfunction 10y agoIt's been tried and failed. See [1]. [1] https://cygwin.com/ml/cygwin-developers/2011-04/msg00036.html https://cygwin.com/ml/cygwin-developers/2011-04/msg00036.htm...
- CUViper 10y agomidipix is trying to use it, and advertises copy-on-write fork as an advantage over Cygwin, but I don't know how well it works yet. http://midipix.org/#sec-midipix http://midipix.org/#sec-midipix http://midipix.org/git/cgit.cgi/ntapi/tree/src/process http://midipix.org/git/cgit.cgi/ntapi/tree/src/process
- bboreham 10y ago> Also I wonder why they would need this undocumented call. To implement the first NT Posix subsystem, which was a FIPS requirement.