Skip to content

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

Merged
smorimoto merged 1 commit into
ocsigen:masterfrom
MisterDA:socketpair-windows
Nov 7, 2021
Merged

smorimoto merged 1 commit into
ocsigen:masterfrom
MisterDA:socketpair-windows

Conversation

@MisterDA

@MisterDA MisterDA commented Jun 24, 2021 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

MisterDA commented Jul 26, 2021 via email

Copy link
Copy Markdown
Contributor Author

@raphael-proust

Copy link
Copy Markdown
Collaborator

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

@avsm

avsm commented Aug 5, 2021

Copy link
Copy Markdown
Collaborator

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

dra27 commented Aug 5, 2021

Copy link
Copy Markdown
Contributor

Looks good to me, too.

@raphael-proust

Copy link
Copy Markdown
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
Copy Markdown
Collaborator

Done in #876

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

@MisterDA
MisterDA force-pushed the socketpair-windows branch from 4409f7c to fbd2900 Compare August 30, 2021 11:19
@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.
@MisterDA
MisterDA force-pushed the socketpair-windows branch from fbd2900 to dad167f Compare October 6, 2021 21:23
@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.

5 participants