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.
This commit is contained in:
David Carlier 2021-12-29 08:53:56 +00:00 committed by Christoph M. Becker
parent f1d7f95702
commit 09165ace37
No known key found for this signature in database
GPG Key ID: D66C9593118BCCB6
3 changed files with 5 additions and 1 deletions

2
NEWS
View File

@ -2,6 +2,8 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2022, PHP 8.0.16
- Sockets:
. Fixed ext/sockets build on Haiku. (David Carlier)
20 Jan 2022, PHP 8.0.15

View File

@ -718,7 +718,7 @@ int php_if_index_to_addr4(unsigned if_index, php_socket *php_sock, struct in_add
return SUCCESS;
}
#if !defined(ifr_ifindex) && defined(ifr_index)
#if !defined(ifr_ifindex) && (defined(ifr_index) || defined(__HAIKU__))
#define ifr_ifindex ifr_index
#endif

View File

@ -472,7 +472,9 @@ static PHP_MINIT_FUNCTION(sockets)
REGISTER_LONG_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT);
#ifdef SOCK_RDM
REGISTER_LONG_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT);
#endif
REGISTER_LONG_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT);