Skip to content

Commit 09165ac

Browse files
devnexencmb69
authored andcommitted
Fix ext/sockets build on Haiku
The `SOCK_RDM` datagram option is unsupported on Haiku; instead `ifreq` has direct access to `ifr_index`. Closes GH-7849.
1 parent f1d7f95 commit 09165ac

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2022, PHP 8.0.16
44

5+
- Sockets:
6+
. Fixed ext/sockets build on Haiku. (David Carlier)
57

68
20 Jan 2022, PHP 8.0.15
79

ext/sockets/multicast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ int php_if_index_to_addr4(unsigned if_index, php_socket *php_sock, struct in_add
718718
return SUCCESS;
719719
}
720720

721-
#if !defined(ifr_ifindex) && defined(ifr_index)
721+
#if !defined(ifr_ifindex) && (defined(ifr_index) || defined(__HAIKU__))
722722
#define ifr_ifindex ifr_index
723723
#endif
724724

ext/sockets/sockets.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,9 @@ static PHP_MINIT_FUNCTION(sockets)
472472
REGISTER_LONG_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT);
473473
REGISTER_LONG_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT);
474474
REGISTER_LONG_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT);
475+
#ifdef SOCK_RDM
475476
REGISTER_LONG_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT);
477+
#endif
476478

477479
REGISTER_LONG_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT);
478480
REGISTER_LONG_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT);

0 commit comments

Comments
 (0)