Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
  • Loading branch information
MisterDA and dra27 committed Feb 4, 2021
1 parent 6c6e7cb commit 4e692b2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion manual/src/library/libunix.etex
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ processes}
\entree{"getpwnam", "getpwuid"}{always raise "Not_found"}
\entree{"getgrnam", "getgrgid"}{always raise "Not_found"}
\entree{type "socket_domain"}{"PF_INET" is fully supported;
"PF_INET6" is fully supported (since 4.01.0); "PF_UNIX" is supported since Windows 10 1803.}
"PF_INET6" is fully supported (since 4.01.0); "PF_UNIX" is supported since 4.13.0, but only works on Windows 10 1803 and later.}
\entree{"establish_server"}{not implemented; use threads}
\entree{terminal functions ("tc*")}{not implemented}
\entree{"setsid"}{not implemented}
Expand Down
5 changes: 2 additions & 3 deletions otherlibs/unix/socketaddr.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@

typedef struct sockaddr_un
{
ADDRESS_FAMILY sun_family; /* AF_UNIX */
char sun_path[UNIX_PATH_MAX]; /* pathname */
ADDRESS_FAMILY sun_family;
char sun_path[UNIX_PATH_MAX];
} SOCKADDR_UN, *PSOCKADDR_UN;

// Returns ULONG PID of the connected peer process
#define SIO_AF_UNIX_GETPEERPID _WSAIOR(IOC_VENDOR, 256)

#endif
Expand Down
2 changes: 1 addition & 1 deletion otherlibs/unix/unix.mli
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ type socket_domain =
(** The type of socket domains. Not all platforms support
IPv6 sockets (type [PF_INET6]).
On Windows: [PF_UNIX] supported since Windows 10 1803. *)
On Windows: [PF_UNIX] supported since 4.13.0 on Windows 10 1803 and later. *)

type socket_type =
SOCK_STREAM (** Stream socket *)
Expand Down
9 changes: 4 additions & 5 deletions otherlibs/win32unix/socketpair.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ extern int socket_type_table[]; /* from socket.c */
#ifdef HAS_SOCKETPAIR

#error "Windows has defined sockepair! win32unix should be updated."
CAMLprim value unix_socketpair(value cloexec, value domain, value type,
value protocol)
{ caml_invalid_argument("socketpair not implemented"); }

#else

Expand Down Expand Up @@ -83,9 +80,11 @@ static int socketpair(int domain, int type, int protocol,

/* The documentation requires removing the file before binding the socket. */
if (DeleteFile(path) == 0) {
win32_maperr(GetLastError());
if (errno != ENOENT)
drc = GetLastError();
if (drc != ERROR_FILE_NOT_FOUND) {
win32_maperr(drc);
goto fail_sockets;
}
}

rc = bind(listener, (struct sockaddr *) &addr, socklen);
Expand Down

0 comments on commit 4e692b2

Please sign in to comment.