mio icon indicating copy to clipboard operation
mio copied to clipboard

Follow up to switch to windows-sys

Open Thomasdezeeuw opened this issue 2 years ago • 9 comments

Based on https://github.com/tokio-rs/mio/pull/1556, in particular this comment: https://github.com/tokio-rs/mio/pull/1556#pullrequestreview-920136232.

  • [ ] Move the SIO_BSP_* constants, https://github.com/microsoft/win32metadata/issues/844.
  • [ ] Replace Handle with std::os::windows::io::OwnedHandle (once stable).
  • [ ] Remove the feature for AF_INET(6) constants, see https://github.com/microsoft/win32metadata/issues/845.

Thomasdezeeuw avatar Mar 31 '22 08:03 Thomasdezeeuw

These fixes have now been published as part of the 0.35.0 release:

https://github.com/microsoft/windows-rs/releases/tag/0.35.0

kennykerr avatar Apr 05 '22 15:04 kennykerr

This https://github.com/microsoft/windows-rs/pull/1636 might be a bit of problem, as Mio supports older rustc versions. Does windows-sys give any MSRV guarantees?

Thomasdezeeuw avatar Apr 05 '22 16:04 Thomasdezeeuw

It's currently set to 1.56:

https://github.com/microsoft/windows-rs/blob/d3c2f2ca9385a0f03162e33da40dcc350678161d/.github/workflows/build.yml#L52

Previously it was set to 1.46.0, which should still work in theory but cargo doesn't like it when the version is older than what Rust 2021 supports.

kennykerr avatar Apr 05 '22 16:04 kennykerr

This issue is now blocked on https://github.com/tokio-rs/mio/issues/1562.

Thomasdezeeuw avatar Apr 09 '22 14:04 Thomasdezeeuw

0.36.0 has been released and reverts the Rust 2021 adoption meaning that windows-sys is once again supported on Rust 1.46.

kennykerr avatar Apr 26 '22 18:04 kennykerr

@Thomasdezeeuw in that case I think we should put this back on the table

Noah-Kennedy avatar Apr 26 '22 20:04 Noah-Kennedy

Updating to 0.36 in https://github.com/tokio-rs/mio/pull/1569.

I couldn't find the SIO_BSP_* constants although the linked issue is closed, have those been added @kennykerr?

Thomasdezeeuw avatar Apr 27 '22 10:04 Thomasdezeeuw

I couldn't find the SIO_BSP_* constants although the linked issue is closed, have those been added?

Which one in particular? I see a bunch have been added.

Adding @riverar who may have further insights.

kennykerr avatar Apr 27 '22 14:04 kennykerr

I couldn't find the SIO_BSP_* constants although the linked issue is closed, have those been added?

Which one in particular? I see a bunch have been added.

I just realised GitHub doesn't have partial search, window-sys actually has all the constants Mio need. Sorry about that

Thomasdezeeuw avatar Apr 27 '22 15:04 Thomasdezeeuw

After https://github.com/tokio-rs/mio/pull/1688 all that is left are some AFD related types and constants (see updated issue description), so looking pretty good.

Thomasdezeeuw avatar Dec 08 '23 08:12 Thomasdezeeuw

Closing this as done, we can switch to using AFD constants from windows-sys if/when those become available, no point in keeping this open.

Thomasdezeeuw avatar Dec 23 '23 17:12 Thomasdezeeuw

Happy to add those now; just need a pointer to what's missing/needed. Is it just the POLL_xxx constants linked above?

riverar avatar Dec 23 '23 18:12 riverar

Ah, I see the others. Will be interesting to get these into metadata, given they're undocumented/"private" structures.

//
// Structures for IOCTL_AFD_POLL.
//

typedef struct _AFD_POLL_HANDLE_INFO {
    HANDLE Handle;
    ULONG PollEvents;
    NTSTATUS Status;
} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO;

typedef struct _AFD_POLL_INFO {
    LARGE_INTEGER Timeout;
    ULONG NumberOfHandles;
    BOOLEAN Unique;
    AFD_POLL_HANDLE_INFO Handles[1];
} AFD_POLL_INFO, *PAFD_POLL_INFO;

riverar avatar Dec 23 '23 18:12 riverar

Ah, I see the others. Will be interesting to get these into metadata, given they're undocumented/"private" structures.

I suspected as much. I'm happy to keep the definitions in Mio as well.

Thomasdezeeuw avatar Dec 24 '23 12:12 Thomasdezeeuw