2020-06-15 14:18:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_SOCK_SOCK_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_SOCK_SOCK_H_
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
|
|
|
|
#define INET_ADDRSTRLEN 22
|
2022-08-21 04:36:07 +00:00
|
|
|
#define IFHWADDRLEN 6
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2023-06-06 10:30:37 +00:00
|
|
|
uint16_t htons(uint16_t) pureconst;
|
|
|
|
uint16_t ntohs(uint16_t) pureconst;
|
|
|
|
uint32_t htonl(uint32_t) pureconst;
|
|
|
|
uint32_t ntohl(uint32_t) pureconst;
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2022-08-21 04:36:07 +00:00
|
|
|
#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
|
2021-06-26 01:41:02 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
const char *inet_ntop(int, const void *, char *, uint32_t);
|
2021-02-21 06:52:46 +00:00
|
|
|
int inet_pton(int, const char *, void *);
|
|
|
|
uint32_t inet_addr(const char *);
|
2021-06-24 19:31:26 +00:00
|
|
|
uint32_t *GetHostIps(void);
|
2020-06-15 14:18:57 +00:00
|
|
|
|
Introduce --strace flag for system call tracing
This is similar to the --ftrace (c function call trace) flag, except
it's less noisy since it only logs system calls to stderr. Having this
flag is valuable because (1) system call tracing tells us a lot about
the behavior of complex programs and (2) it's usually very hard to get
system call tracing on various operating systems, e.g. strace, ktrace,
dtruss, truss, nttrace, etc. Especially on Apple platforms where even
with the special boot trick, debuggers still aren't guaranteed to work.
make -j8 o//examples
o//examples/hello.com --strace
This is enabled by default in MODE=, MODE=opt, and MODE=dbg. In MODE=dbg
extra information will be printed.
make -j8 MODE=dbg o/dbg/examples
o/dbg/examples/hello.com --strace |& less
This change also changes:
- Rename IsText() → _istext()
- Rename IsUtf8() → _isutf8()
- Fix madvise() on Windows NT
- Fix empty string case of inet_ntop()
- vfork() wrapper now saves and restores errno
- Update xsigaction() to yoink syscall support
2022-03-19 01:07:28 +00:00
|
|
|
int socket(int, int, int);
|
2020-06-15 14:18:57 +00:00
|
|
|
int listen(int, int);
|
|
|
|
int shutdown(int, int);
|
Introduce --strace flag for system call tracing
This is similar to the --ftrace (c function call trace) flag, except
it's less noisy since it only logs system calls to stderr. Having this
flag is valuable because (1) system call tracing tells us a lot about
the behavior of complex programs and (2) it's usually very hard to get
system call tracing on various operating systems, e.g. strace, ktrace,
dtruss, truss, nttrace, etc. Especially on Apple platforms where even
with the special boot trick, debuggers still aren't guaranteed to work.
make -j8 o//examples
o//examples/hello.com --strace
This is enabled by default in MODE=, MODE=opt, and MODE=dbg. In MODE=dbg
extra information will be printed.
make -j8 MODE=dbg o/dbg/examples
o/dbg/examples/hello.com --strace |& less
This change also changes:
- Rename IsText() → _istext()
- Rename IsUtf8() → _isutf8()
- Fix madvise() on Windows NT
- Fix empty string case of inet_ntop()
- vfork() wrapper now saves and restores errno
- Update xsigaction() to yoink syscall support
2022-03-19 01:07:28 +00:00
|
|
|
ssize_t send(int, const void *, size_t, int);
|
2020-06-15 14:18:57 +00:00
|
|
|
ssize_t recv(int, void *, size_t, int);
|
|
|
|
ssize_t sendfile(int, int, int64_t *, size_t);
|
Introduce --strace flag for system call tracing
This is similar to the --ftrace (c function call trace) flag, except
it's less noisy since it only logs system calls to stderr. Having this
flag is valuable because (1) system call tracing tells us a lot about
the behavior of complex programs and (2) it's usually very hard to get
system call tracing on various operating systems, e.g. strace, ktrace,
dtruss, truss, nttrace, etc. Especially on Apple platforms where even
with the special boot trick, debuggers still aren't guaranteed to work.
make -j8 o//examples
o//examples/hello.com --strace
This is enabled by default in MODE=, MODE=opt, and MODE=dbg. In MODE=dbg
extra information will be printed.
make -j8 MODE=dbg o/dbg/examples
o/dbg/examples/hello.com --strace |& less
This change also changes:
- Rename IsText() → _istext()
- Rename IsUtf8() → _isutf8()
- Fix madvise() on Windows NT
- Fix empty string case of inet_ntop()
- vfork() wrapper now saves and restores errno
- Update xsigaction() to yoink syscall support
2022-03-19 01:07:28 +00:00
|
|
|
int getsockopt(int, int, int, void *, uint32_t *);
|
2020-09-07 04:39:00 +00:00
|
|
|
int setsockopt(int, int, int, const void *, uint32_t);
|
Introduce --strace flag for system call tracing
This is similar to the --ftrace (c function call trace) flag, except
it's less noisy since it only logs system calls to stderr. Having this
flag is valuable because (1) system call tracing tells us a lot about
the behavior of complex programs and (2) it's usually very hard to get
system call tracing on various operating systems, e.g. strace, ktrace,
dtruss, truss, nttrace, etc. Especially on Apple platforms where even
with the special boot trick, debuggers still aren't guaranteed to work.
make -j8 o//examples
o//examples/hello.com --strace
This is enabled by default in MODE=, MODE=opt, and MODE=dbg. In MODE=dbg
extra information will be printed.
make -j8 MODE=dbg o/dbg/examples
o/dbg/examples/hello.com --strace |& less
This change also changes:
- Rename IsText() → _istext()
- Rename IsUtf8() → _isutf8()
- Fix madvise() on Windows NT
- Fix empty string case of inet_ntop()
- vfork() wrapper now saves and restores errno
- Update xsigaction() to yoink syscall support
2022-03-19 01:07:28 +00:00
|
|
|
int socketpair(int, int, int, int[2]);
|
2022-08-20 19:32:51 +00:00
|
|
|
int sockatmark(int);
|
2020-06-15 14:18:57 +00:00
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_SOCK_SOCK_H_ */
|