Skip to content

Commit

Permalink
Fix ext/sockets build on Haiku
Browse files Browse the repository at this point in the history
The `SOCK_RDM` datagram option is unsupported on Haiku; instead `ifreq`
has direct access to `ifr_index`.

Closes GH-7849.
  • Loading branch information
devnexen authored and cmb69 committed Jan 4, 2022
1 parent f1d7f95 commit 09165ac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ext/sockets/multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions ext/sockets/sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 09165ac

Please sign in to comment.