60 lines
2.0 KiB
TOML
60 lines
2.0 KiB
TOML
# bits/iovec.h brings in size_t
|
|
sys_includes = ["stddef.h", "stdint.h"]
|
|
include_guard = "_RELIBC_SYS_SOCKET_H"
|
|
after_includes = """
|
|
#include <bits/iovec.h> // for iovec from sys/uio.h
|
|
#include <bits/safamily-t.h> // for sa_family_t
|
|
#include <bits/socklen-t.h> // for socklen_t
|
|
#include <bits/ssize-t.h> // for ssize_t from sys/types.h
|
|
|
|
// Below required for Non-POSIX ucred struct
|
|
#include <bits/gid-t.h> // for gid_t from sys/types.h
|
|
#include <bits/pid-t.h> // for pid_t from sys/types.h
|
|
#include <bits/uid-t.h> // for uid_t from sys/types.h
|
|
"""
|
|
trailer = """
|
|
#ifndef _RELIBC_BITS_SYS_SOCKET_H
|
|
#define _RELIBC_BITS_SYS_SOCKET_H
|
|
|
|
struct sockaddr_storage {
|
|
sa_family_t ss_family;
|
|
char __ss_padding[128-sizeof(long)-sizeof(sa_family_t)];
|
|
unsigned long __ss_align;
|
|
};
|
|
|
|
// These definitions were taken from musl, license MIT {
|
|
#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1))
|
|
#define __CMSG_NEXT(cmsg) ((unsigned char *)(cmsg) + __CMSG_LEN(cmsg))
|
|
#define __MHDR_END(mhdr) ((unsigned char *)(mhdr)->msg_control + (mhdr)->msg_controllen)
|
|
|
|
#define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1))
|
|
#define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \
|
|
__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
|
|
? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg))
|
|
#define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
|
|
|
|
#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
|
|
#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
|
|
#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
|
|
// } from musl, license MIT
|
|
|
|
#endif // _RELIBC_BITS_SYS_SOCKET_H
|
|
"""
|
|
language = "C"
|
|
style = "Tag"
|
|
no_includes = true
|
|
cpp_compat = true
|
|
|
|
[enum]
|
|
prefix_with_name = true
|
|
|
|
[export]
|
|
include = [
|
|
"linger",
|
|
"cmsghdr",
|
|
"ucred"
|
|
]
|
|
|
|
[export.rename]
|
|
"iovec" = "struct iovec"
|