Reduce header complexity

- Remove most __ASSEMBLER__ __LINKER__ ifdefs
- Rename libc/intrin/bits.h to libc/serialize.h
- Block pthread cancelation in fchmodat() polyfill
- Remove `clang-format off` statements in third_party
This commit is contained in:
Justine Tunney 2023-11-28 14:24:28 -08:00
parent 96f979dfc5
commit fa20edc44d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
3057 changed files with 410 additions and 4398 deletions

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_ARPHDR_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_ARPHDR_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct arphdr {
@ -12,5 +11,4 @@ struct arphdr {
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_ARPHDR_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_ARPREQ_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_ARPREQ_H_
#include "libc/sock/struct/sockaddr.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct arpreq {
@ -13,5 +12,4 @@ struct arpreq {
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_ARPREQ_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_CMSGHDR_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_CMSGHDR_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#define CMSG_DATA(cmsg) ((unsigned char *)(((struct cmsghdr *)(cmsg)) + 1))
@ -38,5 +37,4 @@ struct cmsghdr { /* linux abi */
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_CMSGHDR_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_CMSGHDR_INTERNAL_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_CMSGHDR_INTERNAL_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct cmsghdr_bsd {
@ -10,5 +9,4 @@ struct cmsghdr_bsd {
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_CMSGHDR_INTERNAL_H_ */

View file

@ -3,7 +3,6 @@
#define ETH_ALEN 6
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct ether_addr {
@ -17,5 +16,4 @@ struct ether_header {
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_ETHER_HEADER_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_IFCONF_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_IFCONF_H_
#include "libc/sock/struct/ifreq.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/*
@ -24,5 +23,4 @@ struct ifconf {
#define ifc_req ifc_ifcu.ifcu_req /* array of structures */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_IFCONF_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_IFREQ_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_IFREQ_H_
#include "libc/sock/struct/sockaddr.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#define IF_NAMESIZE 16
@ -29,5 +28,4 @@ struct ifreq {
#define ifr_flags ifr_ifru.ifru_flags /* flags */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_IFREQ_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_IN6_PKTINFO_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_IN6_PKTINFO_H_
#include "libc/sock/struct/sockaddr6.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct in6_pktinfo {
@ -10,5 +9,4 @@ struct in6_pktinfo {
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_IN6_PKTINFO_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_IN_PKTINFO_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_IN_PKTINFO_H_
#include "libc/sock/struct/sockaddr.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct in_pktinfo {
@ -11,5 +10,4 @@ struct in_pktinfo {
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_IN_PKTINFO_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_IP_MREQ_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_IP_MREQ_H_
#include "libc/sock/struct/sockaddr.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct ip_mreq {
@ -10,5 +9,4 @@ struct ip_mreq {
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_IP_MREQ_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_LINGER_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_LINGER_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct linger { /* Linux+XNU+BSD ABI */
@ -9,5 +8,4 @@ struct linger { /* Linux+XNU+BSD ABI */
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_LINGER_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_MSGHDR_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_MSGHDR_H_
#include "libc/calls/struct/iovec.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct msghdr { /* Linux+NT ABI */
@ -18,5 +17,4 @@ ssize_t recvmsg(int, struct msghdr *, int);
ssize_t sendmsg(int, const struct msghdr *, int);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_MSGHDR_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_MSGHDR_INTERNAL_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_MSGHDR_INTERNAL_H_
#include "libc/sock/struct/msghdr.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct msghdr_bsd {
@ -19,5 +18,4 @@ ssize_t sys_recvmsg(int, struct msghdr *, int);
bool __asan_is_valid_msghdr(const struct msghdr *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_MSGHDR_INTERNAL_H_ */

View file

@ -2,7 +2,6 @@
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_POLLFD_H_
#include "libc/calls/struct/sigset.h"
#include "libc/calls/struct/timespec.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct pollfd {
@ -15,5 +14,4 @@ int poll(struct pollfd *, uint64_t, int32_t);
int ppoll(struct pollfd *, uint64_t, const struct timespec *, const sigset_t *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_POLLFD_H_ */

View file

@ -4,7 +4,6 @@
#include "libc/calls/struct/timespec.h"
#include "libc/mem/alloca.h"
#include "libc/sock/struct/pollfd.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int32_t sys_poll(struct pollfd *, uint64_t, signed);
@ -18,5 +17,4 @@ const char *DescribePollFds(char[300], ssize_t, struct pollfd *, size_t);
#define DescribePollFds(x, y, z) DescribePollFds(alloca(300), x, y, z)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_POLLFD_INTERNAL_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_SOCKADDR_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_SOCKADDR_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct sockaddr { /* Linux+NT ABI */
@ -46,5 +45,4 @@ ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *,
uint32_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_SOCKADDR_H_ */

View file

@ -3,7 +3,6 @@
#include "libc/mem/alloca.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/sock/struct/sockaddr6-bsd.internal.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct sockaddr_bsd {
@ -55,5 +54,4 @@ void sockaddr2linux(const union sockaddr_storage_bsd *, uint32_t,
union sockaddr_storage_linux *, uint32_t *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_SOCKADDR_INTERNAL_H_ */

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_SOCKADDR6_BSD_INTERNAL_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_SOCKADDR6_BSD_INTERNAL_H_
#include "libc/sock/struct/sockaddr6.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct sockaddr_in6_bsd {
@ -14,5 +13,4 @@ struct sockaddr_in6_bsd {
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_SOCKADDR6_BSD_INTERNAL_H_ */

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_SOCKADDR6_H_
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_SOCKADDR6_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
struct in6_addr {
union {
@ -18,5 +17,4 @@ struct sockaddr_in6 { /* Linux+NT ABI */
uint32_t sin6_scope_id; /* rfc2553 */
};
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SOCKADDR6_H_ */