Skip to content
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

Support Unix.socketpair using PF_UNIX on Windows and OCaml 4.14 #870

Merged
merged 1 commit into from
Nov 7, 2021

Conversation

MisterDA
Copy link
Contributor

@MisterDA MisterDA commented Jun 24, 2021

A few improvements (imho) to the support of socketpair under Windows:

  • fix the socket_domain_table length;
  • add support for IPv6 socketpair emulation (I'm rooting for the Universal Deployment of IPv6);
  • support Unix domain sockets and socketpair emulation using Unix domain sockets to be introduced in OCaml 4.14 (PR 10192).

This allows us to use socketpair and Unix domain sockets to perform IO redirection with processes, which isn't possible with current sockets in OCaml under Windows. Sockets have to be created in non-overlapped mode, with WSASocket(domain, type, protocol, NULL, 0, 0) rather than socket(domain, type, protocol) (overlapped). Unix domain sockets under Windows don't have this limitation.

@raphael-proust
Copy link
Collaborator

Hi,

Thanks for the contribution. IIUC, this won't be effective until OCaml4.14 is released (or until someone installs it within a custom opam switch or something along those lines). I'm tempted to withhold merging until 4.14 is released or is about to be released. It might be a bit long though.

In the meantime, I'll try to get someone with more C and system-programming chops to do the review.

@MisterDA
Copy link
Contributor Author

MisterDA commented Jul 26, 2021 via email

@raphael-proust
Copy link
Collaborator

Ok, I'll cherry-pick those after the review. Thanks!

@avsm
Copy link
Collaborator

avsm commented Aug 5, 2021

I've read through this and it looks fine to me, and matches the upstream PR to OCaml 4.14 that @MisterDA submitted. I'd be ok with the cherrypick. Perhaps @dra27 can have a look if he has time.

@dra27
Copy link
Contributor

dra27 commented Aug 5, 2021

Looks good to me, too.

@raphael-proust
Copy link
Collaborator

Ok, I'll open a branch for cherry-picking the prefix of the PR. Thanks for the reviews!

@raphael-proust raphael-proust mentioned this pull request Aug 6, 2021
@raphael-proust
Copy link
Collaborator

Done in #876

I simply cherry-picked the commits and added a changelog entry. I'll merge once the CI passes.

@MisterDA MisterDA changed the title Socketpair windows Support Unix.socketpair using PF_UNIX on Windows and OCaml 4.14 Aug 30, 2021
Support for Unix domain sockets on Windows and a socketpair emulation
using PF_UNIX was added in OCaml 4.14 in PR 10192.
@smorimoto smorimoto merged commit 47dd9e5 into ocsigen:master Nov 7, 2021
@MisterDA MisterDA deleted the socketpair-windows branch November 7, 2021 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants