-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_get_osfhandle in Addon fails on Windows #6369
Comments
Related: #6274. We need a way to re-export symbols that aren't marked |
The best way to go about it is probably to make the |
I'd rather make node properly re-export symbols. We need that anyway to make linking against openssl possible on Windows. I've been nibbling at it but it's slow going. |
I tried to port mmap.js to windows (https://github.com/dimichgh/mmap.js/blob/master/src/winmmap.h#L58), but due to this issue, I am now blocked. |
This is hard blocker for https://github.com/resin-io/etcher. I opened an issue in libuv. I'm happy to contribute a patch to make |
It's a year to the day. Any progress on this? |
@baudehlo I just sent a PR for this: libuv/libuv#1323 |
The uv__get_osfhandle() function is a private functio of the Windows subsystem, and its used to get a Windows HANDLE out of a file descriptor number. The motivation behind making this function public is to allow Node.js programs to pass file descriptors created using fs.open() to native Node.js C++ add-ons, and be able to successfully convert them to Windows HANDLEs. Refs: #1166 Refs: nodejs/node#6369 Fixes: #1291 PR-URL: #1323 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
I guess this was solved by libuv/libuv#1323. Closing. |
Functionality * Use always page file backed MMF on windows (due to issue nodejs/node#6369). * On windows pass page file name to mmap_map. * Do not CloseHandle of mapped file until cleaning up as closing handle closes also connection to page file backed MMF. * Throw unsupported error for mincore on windows Windows build * Compile flags around mincore calls * npm prepublish script changed from 'make ls' to direct call of 'node lsc...'
@bzoz yes indeed, it does work. I've updated my test app (https://github.com/davedoesdev/node-windows-fd-test, see first comment in this ticket) to use @jviotti thanks for fixing this. |
_get_osfhandle
fails to map a file descriptor opened in Javascript to a handle.Please see https://github.com/davedoesdev/node-windows-fd-test for a simple repro. It's also seen in baudehlo/node-fs-ext#57 and nodejs/node-gyp#416
I think this is due to MSVCR being statically linked into Node.
_get_osfhandle
can't find a descriptor opened in Javascript because the file descriptor to handle map in the Addon is separate to the one statically linked into the Node executable.It would be nice to be able to use file descriptors passed into Addons on Windows. One idea is to expose
_get_osfhandle
(or a wrapper) from the Node executable for Addons to link against and call.The text was updated successfully, but these errors were encountered: