mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 19:43:32 +00:00
eeb20775d2
This will help C++ code that uses exceptions to be tinier. For example, this change shaves away 1000 lines of assembly code from LLVM's libcxx, which is 0.7% of all assembly instructions in the entire library.
37 lines
1.3 KiB
C
37 lines
1.3 KiB
C
#ifndef COSMOPOLITAN_LIBC_SOCK_SOCK_H_
|
|
#define COSMOPOLITAN_LIBC_SOCK_SOCK_H_
|
|
COSMOPOLITAN_C_START_
|
|
|
|
#define INET_ADDRSTRLEN 22
|
|
#define IFHWADDRLEN 6
|
|
|
|
libcesque uint16_t htons(uint16_t) pureconst;
|
|
libcesque uint16_t ntohs(uint16_t) pureconst;
|
|
libcesque uint32_t htonl(uint32_t) pureconst;
|
|
libcesque uint32_t ntohl(uint32_t) pureconst;
|
|
|
|
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
|
#define htons(x) __builtin_bswap16(x)
|
|
#define ntohs(x) __builtin_bswap16(x)
|
|
#define htonl(x) __builtin_bswap32(x)
|
|
#define ntohl(x) __builtin_bswap32(x)
|
|
#endif
|
|
|
|
const char *inet_ntop(int, const void *, char *, uint32_t) libcesque;
|
|
int inet_pton(int, const char *, void *) libcesque;
|
|
uint32_t inet_addr(const char *) libcesque;
|
|
libcesque uint32_t *GetHostIps(void) __wur;
|
|
|
|
int socket(int, int, int) libcesque;
|
|
int listen(int, int) libcesque;
|
|
int shutdown(int, int) libcesque;
|
|
ssize_t send(int, const void *, size_t, int) libcesque;
|
|
ssize_t recv(int, void *, size_t, int) libcesque;
|
|
ssize_t sendfile(int, int, int64_t *, size_t) libcesque;
|
|
int getsockopt(int, int, int, void *, uint32_t *) libcesque;
|
|
int setsockopt(int, int, int, const void *, uint32_t) libcesque;
|
|
int socketpair(int, int, int, int[2]) libcesque;
|
|
int sockatmark(int) libcesque;
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* COSMOPOLITAN_LIBC_SOCK_SOCK_H_ */
|