Skip to content

Commit 12204c1

Browse files
committed
afunix: add compatibility header
1 parent bafc223 commit 12204c1

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

include/HsNet.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# include <ws2tcpip.h>
3030
# include <mswsock.h>
3131
# include "win32defs.h"
32-
# include <afunix.h>
32+
# include "afunix_compat.h"
3333
# define IPV6_V6ONLY 27
3434
#endif
3535

include/afunix_compat.h

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* The version of afunix.h provided by the version of MSYS2 included with x86
2+
* versions of GHC before GHC 9.2 excludes certain components introduced with
3+
* Windows Vista.
4+
*/
5+
6+
#ifndef AFUNIX_COMPAT_H
7+
#define AFUNIX_COMPAT_H
8+
9+
#if defined(_AFUNIX_) || !defined(_WIN32) || __GLASGOW_HASKELL__ > 902
10+
# include <afunix.h>
11+
#else
12+
13+
#define UNIX_PATH_MAX 108
14+
15+
typedef struct sockaddr_un {
16+
ADDRESS_FAMILY sun_family;
17+
char sun_path[UNIX_PATH_MAX];
18+
} SOCKADDR_UN, *PSOCKADDR_UN;
19+
20+
#define SIO_AF_UNIX_GETPEERPID _WSAIOR(IOC_VENDOR, 256)
21+
22+
#endif /* GHC version check */
23+
#endif /* AFUNIX_COMPAT_H */

network.cabal

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ extra-source-files:
6666
include/HsNetworkConfig.h.in
6767
include/HsNet.h
6868
include/HsNetDef.h
69+
include/afunix_compat.h
6970
cbits/asyncAccept.c
7071
cbits/initWinSock.c
7172
cbits/winSockErr.c

0 commit comments

Comments
 (0)