Files
llvm-project/libc/include/sys/socket.yaml
Pavel Labath 89894b6748 [libc] Add struct cmsghdr and associated macros (#193756)
The macros are the main source of subtlety. The interesting aspects are:
- some implementations CMSG_ALIGN the size of struct cmsghdr, but this
is a noop. Instead of doing that, I added an assertion in the test.
- POSIX permits CMSG_NXTHDR to return null if the buffer has no space
for the data array, and this behavior differs between implementations.
This implementation does not do that in order to match CMSG_FIRSTHDR,
which doesn't have such an option.
- some implementations redirect the CMSG_NXTHDR macro to an (extern or
static inline) function. I implemented this inside the macro to avoid
having to define a (private ?) entry point for that function.

---------

Co-authored-by: Jeff Bailey <jbailey@raspberryginger.com>
2026-04-27 10:54:07 +02:00

161 lines
3.1 KiB
YAML

header: sys/socket.h
standards:
- posix
macros:
- macro_name: AF_UNSPEC
macro_header: sys-socket-macros.h
types:
- type_name: struct_sockaddr
- type_name: struct_sockaddr_storage
- type_name: socklen_t
- type_name: sa_family_t
- type_name: struct_cmsghdr
- type_name: struct_msghdr
- type_name: struct_iovec
- type_name: struct_linger
- type_name: size_t
- type_name: ssize_t
enums: []
objects: []
functions:
- name: accept
standards:
- POSIX
return_type: int
arguments:
- type: int
- type: struct sockaddr *__restrict
- type: socklen_t *__restrict
- name: accept4
standards:
- Linux
return_type: int
arguments:
- type: int
- type: struct sockaddr *__restrict
- type: socklen_t *__restrict
- type: int
- name: bind
standards:
- POSIX
return_type: int
arguments:
- type: int
- type: const struct sockaddr *
- type: socklen_t
- name: connect
standards:
- POSIX
return_type: int
arguments:
- type: int
- type: const struct sockaddr *
- type: socklen_t
- name: getsockopt
standards:
- POSIX
return_type: int
arguments:
- type: int
- type: int
- type: int
- type: void *__restrict
- type: socklen_t *__restrict
- name: listen
standards:
- POSIX
return_type: int
arguments:
- type: int
- type: int
- name: recv
standards:
- POSIX
return_type: ssize_t
arguments:
- type: int
- type: void *
- type: size_t
- type: int
- name: recvfrom
standards:
- POSIX
return_type: ssize_t
arguments:
- type: int
- type: void *
- type: size_t
- type: int
- type: struct sockaddr *__restrict
- type: socklen_t *__restrict
- name: recvmsg
standards:
- POSIX
return_type: ssize_t
arguments:
- type: int
- type: struct msghdr *
- type: int
- name: send
standards:
- POSIX
return_type: ssize_t
arguments:
- type: int
- type: const void*
- type: size_t
- type: int
- name: sendmsg
standards:
- POSIX
return_type: ssize_t
arguments:
- type: int
- type: const struct msghdr *
- type: int
- name: sendto
standards:
- POSIX
return_type: ssize_t
arguments:
- type: int
- type: const void *
- type: size_t
- type: int
- type: const struct sockaddr *
- type: socklen_t
- name: setsockopt
standards:
- POSIX
return_type: int
arguments:
- type: int
- type: int
- type: int
- type: const void *
- type: socklen_t
- name: shutdown
standards:
- POSIX
return_type: int
arguments:
- type: int
- type: int
- name: socket
standards:
- POSIX
return_type: int
arguments:
- type: int
- type: int
- type: int
- name: socketpair
standards:
- posix
return_type: int
arguments:
- type: int
- type: int
- type: int
- type: int*