Re: RFC: adding fd-passing to win32
Marc-André Lureau <[email protected]> Mon, 8 Aug 2022 15:40:22 +0400
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Message-ID | <CAJ+F1CJoP9Me_pJkvMJnuwh5j_ENOw1=cryR+HQ+=x58T7EgnQ@mail.gmail.com> |
Hi On Fri, Aug 5, 2022 at 7:52 PM Thiago Macieira <[email protected]> wrote: > On Friday, 5 August 2022 00:35:54 PDT Marc-André Lureau wrote: > > As you probably know, HANDLEs are not FD. And Windows has the 2 types, > and > > functions to map to/from the 2 (_get_osfhandle/_open_osfhandle). > > There's no way to transport file descriptors as numbers anyway because > they're > local to each application. And on Windows, it's entirely controlled by the > runtime (userspace), which is why those two functions exist. > > That means the wire format is irrelevant. I suggest keeping 'h' because > there's no difference. The fact that on Windows they're marshalled as > actual > handles and on Linux they're out-of-band is an implementation detail. > FDs are not HANDLEs, we shouldn't mix the two (a mistake commonly observed and annoying to clean up). If some day Windows sockets learn SCM_RIGHT, we should transfer FDs values. We could eventually use 'h' for FDs or HANDLEs or SOCKETs (or other kind as necessary), the "handle array" contains the type details. But then 'h' implementation will be different on Windows, regardless of potentially future same SCM_RIGHT support. I think it's a better idea to treat HANDLEs as a different type. -- Marc-André Lureau