GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — A way to pass a file descriptor to Node? · Issue #304 · nodejs/node-addon-api

A way to pass a file descriptor to Node? #304

New issue
Copy link
New issue
Copy link
Closed
Closed
A way to pass a file descriptor to Node?#304
Copy link

Description

@danielgindi
danielgindi
opened on Jul 16, 2018
Issue body actions

As compiling a NAPI module results in a library with a separate CRT, the state containing the FD table is different.
So if I have a situation where I have a HANDLE or an FD that I want to pass to Node - I find it problematic right now.
There's no API to accept a Windows' HANDLE, and no api to duplicate an FD into Node's namespace.

Anyone knows of a way to do that?

Thank you!

Activity

  1. danielgindi commented on Jul 17, 2018

    @danielgindi
    danielgindi
    on Jul 17, 2018
    Author
    More actions

    Basically what I'm looking for is the inverse of uv_get_osfhandle

  2. bzoz commented on Jul 18, 2018

    @bzoz
    bzoz
    on Jul 18, 2018
    More actions

    Duplicate of nodejs/node#15433?

  3. bzoz commented on Jul 18, 2018

    @bzoz
    bzoz
    on Jul 18, 2018
    More actions

    i.e. are you looking for uv_open_osfhandle to get implemented?

  4. danielgindi commented on Jul 18, 2018

    @danielgindi
    danielgindi
    on Jul 18, 2018
    Author
    More actions

    Exactly! uv_open_osfhandle...

  5. danielgindi commented on Jul 18, 2018

    @danielgindi
    danielgindi
    on Jul 18, 2018
    Author
    More actions

    The thing is that the whole issue is about passing an fd across modules, which is not possible in most cases due to separate CRTs (even if you recompile node.exe with msvcrt.dll, you must compile against the same version...)

    But if have a fd you can extract its HANDLE and pass it on to an exported uv_open_osfhandle function which will re-wrap it in its own CRT state.

    So right now it's possible to get an FD from node and use it in a native addon, but not vice versa.

  6. bzoz
    added a commit that references this issue on Jul 19, 2018

    fs: add uv_open_osfhandle

    d2a00b5
  7. bzoz
    added a commit that references this issue on Aug 1, 2018

    fs: add uv_open_osfhandle

    e44174d
  8. bzoz
    added a commit that references this issue on Aug 9, 2018

    fs: add uv_open_osfhandle

    8f96a5b
  9. cjihrig
    added a commit that references this issue on Aug 20, 2018

    deps: upgrade to libuv 1.23.0

    4e7d829
  10. targos
    added a commit that references this issue on Aug 21, 2018

    deps: upgrade to libuv 1.23.0

    a515104
  11. targos
    added a commit that references this issue on Sep 3, 2018

    deps: upgrade to libuv 1.23.0

    90e99da
  12. bzoz commented on Oct 11, 2018

    @bzoz
    bzoz
    on Oct 11, 2018
    More actions

    Fixed by libuv/libuv#1927 included in nodejs/node#22365

  13. danielgindi commented on Oct 11, 2018

    @danielgindi
    danielgindi
    on Oct 11, 2018
    Author
    More actions

    Yeah I already am enjoying this :-)

  14. danielgindi
    closed this as completedon Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.