Why `std::os::unix` is unavailable within `windows-gnu` toolchain?

I understand that windows is not Unix. but that's GNU toolchain, which is based on MinGW, which resembles Unix environment.
For instance, I'd like to use epoll call. And I've successfully tested it in C with MinGW, so seems like there are no obstacle to use it in my rust program under the same environment (windows/gnu based on MinGW, right?).

What's the reason windows-gnu doesn't expose these APIs?

I don't know the actual reason, but Cygwin is not 100% Unix - look here for the un-supported API's.

It is based on MinGW as a build system, but the executables built with it are normal Windows executables, using Windows API, not POSIX API.


@Cerber-Ursi POSIX-using programs built with MinGW are normal Windows executables too. So that's not a reason.

@RedDocMD Cygwin and MinGW are different projects :slight_smile:

They, however, require the POSIX environment to run. windows-gnu-built programs do not.


Have you considered using the mio crate? It is cross-platform and backs tokio for io polling.

1 Like

@Cerber-Ursi hm. indeed, MinGW doesn't include these things. Okay, then that's the reason.

@bjorn3 yeah, I know. I'll use tokio or this mio for the production use if it's needed. the question is just for understanding.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.