Skip to content

Commit d5225a6

Browse files
authored
libc headers: make <complex.h> work, add struct ipv6_mreq (#1100)
1. `libc/isystem/complex.h` (included when you do `#include <complex.h>`) defines `_COMPLEX_H`, and then proceeds to include `libc/complex.h`, which contains the actual complex-related declarations. However, they are *also* guarded by `_COMPLEX_H` and hence effectively ignored. Fix this by changing `_COMPLEX_H` to `COSMOPOLITAN_LIBC_COMPLEX_H_`, which is consistent with what the other headers (such as `math.h`) do. 2. Cosmopolitan could only support IPv4 multicast requests for sockets, since a declaration for `struct ipv6_mreq` was missing. Add support for IPv6, too, by adding the missing declaration.
1 parent c72904b commit d5225a6

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

libc/complex.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _COMPLEX_H
2-
#define _COMPLEX_H
1+
#ifndef COSMOPOLITAN_LIBC_COMPLEX_H_
2+
#define COSMOPOLITAN_LIBC_COMPLEX_H_
33
COSMOPOLITAN_C_START_
44
#if __STDC_VERSION__ + 0 >= 201112 && !defined(__STDC_NO_COMPLEX__)
55

@@ -116,4 +116,4 @@ complex long double cpowl(complex long double, complex long double) libcesque;
116116

117117
#endif /* C11 */
118118
COSMOPOLITAN_C_END_
119-
#endif /* _COMPLEX_H */
119+
#endif /* COSMOPOLITAN_LIBC_COMPLEX_H_ */

libc/isystem/netdb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "libc/sock/struct/in6_pktinfo.h"
66
#include "libc/sock/struct/in_pktinfo.h"
77
#include "libc/sock/struct/ip_mreq.h"
8+
#include "libc/sock/struct/ipv6_mreq.h"
89
#include "libc/sock/struct/sockaddr.h"
910
#include "libc/sock/struct/sockaddr6.h"
1011
#include "libc/sysv/consts/in.h"

libc/isystem/netinet/in.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "libc/sock/struct/in6_pktinfo.h"
77
#include "libc/sock/struct/in_pktinfo.h"
88
#include "libc/sock/struct/ip_mreq.h"
9+
#include "libc/sock/struct/ipv6_mreq.h"
910
#include "libc/sock/struct/sockaddr.h"
1011
#include "libc/sock/struct/sockaddr6.h"
1112
#include "libc/sysv/consts/in.h"

libc/sock/struct/ipv6_mreq.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_IPV6_MREQ_H_
2+
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_IPV6_MREQ_H_
3+
#include "libc/sock/struct/sockaddr6.h"
4+
COSMOPOLITAN_C_START_
5+
6+
struct ipv6_mreq {
7+
struct in6_addr ipv6mr_multiaddr; /* IPv6 multicast address of group */
8+
unsigned ipv6mr_interface; /* local interface */
9+
};
10+
11+
COSMOPOLITAN_C_END_
12+
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_IPV6_MREQ_H_ */

0 commit comments

Comments
 (0)