user: implement mlibc as the libc, finally.
It's finally done.. Signed-off-by: kaguya <vpshinomiya@protonmail.com>
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
#ifndef _ABIBITS_ACCESS_H
|
||||
#define _ABIBITS_ACCESS_H
|
||||
|
||||
#define F_OK 1
|
||||
#define R_OK 2
|
||||
#define W_OK 4
|
||||
#define X_OK 8
|
||||
|
||||
#endif /* _ABIBITS_ACCESS_H */
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef _ABIBITS_AUXV_H
|
||||
#define _ABIBITS_AUXV_H
|
||||
|
||||
#define AT_SECURE 23
|
||||
#define AT_RANDOM 25
|
||||
#define AT_EXECFN 31
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef _ABIBITS_BLKCNT_T_H
|
||||
#define _ABIBITS_BLKCNT_T_H
|
||||
|
||||
/* TODO: use int64_t? */
|
||||
typedef long blkcnt_t;
|
||||
|
||||
#endif /* _ABIBITS_BLKCNT_T_H */
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
#ifndef _ABIBITS_BLKSIZE_T_H
|
||||
#define _ABIBITS_BLKSIZE_T_H
|
||||
|
||||
/* TODO: use int64_t? */
|
||||
typedef long blksize_t;
|
||||
|
||||
#endif /* _ABIBITS_BLKSIZE_T_H */
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef _ABIBITS_CLOCKID_T_H
|
||||
#define _ABIBITS_CLOCKID_T_H
|
||||
|
||||
typedef long clockid_t;
|
||||
|
||||
#endif /* _ABIBITS_CLOCKID_T_H */
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
#ifndef _ABIBITS_DEV_T_H
|
||||
#define _ABIBITS_DEV_T_H
|
||||
|
||||
typedef unsigned long dev_t;
|
||||
|
||||
#endif /* _ABIBITS_DEV_T_H */
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef _ABIBITS_EPOLL_H
|
||||
#define _ABIBITS_EPOLL_H
|
||||
|
||||
#define EPOLL_CLOEXEC 1
|
||||
|
||||
#endif /* _ABIBITS_EPOLL_H */
|
||||
@@ -0,0 +1,149 @@
|
||||
#ifndef _ABIBITS_ERRNO_H
|
||||
#define _ABIBITS_ERRNO_H
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* Input/output error */
|
||||
#define ENXIO 6 /* Device not configured */
|
||||
#define E2BIG 7 /* Argument list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file descriptor */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EDEADLK 11 /* Resource deadlock avoided */
|
||||
/* 11 was EAGAIN */
|
||||
|
||||
#define ENOMEM 12 /* Cannot allocate memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device busy */
|
||||
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* Operation not supported by device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* Too many open files in system */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Inappropriate ioctl for device */
|
||||
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
|
||||
/* math software */
|
||||
#define EDOM 33 /* Numerical argument out of domain */
|
||||
#define ERANGE 34 /* Result too large */
|
||||
|
||||
/* non-blocking and interrupt i/o */
|
||||
#define EAGAIN 35 /* Resource temporarily unavailable */
|
||||
|
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||
#define EINPROGRESS 36 /* Operation now in progress */
|
||||
#define EALREADY 37 /* Operation already in progress */
|
||||
|
||||
/* ipc/network software -- argument errors */
|
||||
#define ENOTSOCK 38 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 39 /* Destination address required */
|
||||
#define EMSGSIZE 40 /* Message too long */
|
||||
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 42 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 43 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
|
||||
#define EOPNOTSUPP 45 /* Operation not supported on socket */
|
||||
#define EPFNOSUPPORT 46 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
|
||||
#define EADDRINUSE 48 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
|
||||
|
||||
/* ipc/network software -- operational errors */
|
||||
#define ENETDOWN 50 /* Network is down */
|
||||
#define ENETUNREACH 51 /* Network is unreachable */
|
||||
#define ENETRESET 52 /* Network dropped connection on reset */
|
||||
#define ECONNABORTED 53 /* Software caused connection abort */
|
||||
#define ECONNRESET 54 /* Connection reset by peer */
|
||||
#define ENOBUFS 55 /* No buffer space available */
|
||||
#define EISCONN 56 /* Socket is already connected */
|
||||
#define ENOTCONN 57 /* Socket is not connected */
|
||||
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
|
||||
#define ETOOMANYREFS 59 /* Too many references: can't splice */
|
||||
#define ETIMEDOUT 60 /* Connection timed out */
|
||||
#define ECONNREFUSED 61 /* Connection refused */
|
||||
|
||||
#define ELOOP 62 /* Too many levels of symbolic links */
|
||||
|
||||
#define ENAMETOOLONG 63 /* File name too long */
|
||||
|
||||
/* should be rearranged */
|
||||
#define EHOSTDOWN 64 /* Host is down */
|
||||
#define EHOSTUNREACH 65 /* No route to host */
|
||||
#define ENOTEMPTY 66 /* Directory not empty */
|
||||
|
||||
/* quotas & mush */
|
||||
#define EPROCLIM 67 /* Too many processes */
|
||||
#define EUSERS 68 /* Too many users */
|
||||
#define EDQUOT 69 /* Disc quota exceeded */
|
||||
|
||||
/* Network File System */
|
||||
#define ESTALE 70 /* Stale NFS file handle */
|
||||
#define EREMOTE 71 /* Too many levels of remote in path */
|
||||
#define EBADRPC 72 /* RPC struct is bad */
|
||||
#define ERPCMISMATCH 73 /* RPC version wrong */
|
||||
#define EPROGUNAVAIL 74 /* RPC prog. not avail */
|
||||
#define EPROGMISMATCH 75 /* Program version wrong */
|
||||
#define EPROCUNAVAIL 76 /* Bad procedure for program */
|
||||
|
||||
|
||||
#define ENOLCK 77 /* No locks available */
|
||||
#define ENOSYS 78 /* Function not implemented */
|
||||
|
||||
#define EFTYPE 79 /* Inappropriate file type or format */
|
||||
#define EOVERFLOW 80
|
||||
#define EILSEQ 81
|
||||
|
||||
#define EBADMSG 82
|
||||
#define ECANCELED 83
|
||||
#define EIDRM 84
|
||||
#define EMULTIHOP 85
|
||||
#define ENOLINK 86
|
||||
#define ENOMSG 87
|
||||
#define ENOTRECOVERABLE 88
|
||||
#define ENOTSUP 89
|
||||
#define EOWNERDEAD 90
|
||||
#define EPROTO 91
|
||||
#define ENODATA 92
|
||||
#define ETIME 93
|
||||
#define ENOKEY 94
|
||||
#define EBADFD 95
|
||||
#define ENOMEDIUM 96
|
||||
#define ENONET 97
|
||||
#define ESTRPIPE 98
|
||||
#define EREMOTEIO 99
|
||||
#define ERFKILL 100
|
||||
#define EBADR 101
|
||||
#define EUNATCH 102
|
||||
#define EMEDIUMTYPE 103
|
||||
#define EKEYREJECTED 104
|
||||
#define EUCLEAN 105
|
||||
#define EBADSLT 106
|
||||
#define ENOANO 107
|
||||
#define ENOCSI 108
|
||||
#define ENOSTR 109
|
||||
#define ENOPKG 110
|
||||
#define EKEYREVOKED 111
|
||||
#define EXFULL 112
|
||||
#define ELNRNG 113
|
||||
#define ENOTUNIQ 114
|
||||
#define ERESTART 115
|
||||
#define ENOTSUP 116
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,85 @@
|
||||
#ifndef _ABIBITS_FCNTL_H
|
||||
#define _ABIBITS_FCNTL_H
|
||||
|
||||
/* reserve 3 bits for the access mode */
|
||||
#define O_ACCMODE 0x0007
|
||||
#define O_EXEC 1
|
||||
#define O_RDONLY 2
|
||||
#define O_RDWR 3
|
||||
#define O_SEARCH 4
|
||||
#define O_WRONLY 5
|
||||
|
||||
/* these flags get their own bit */
|
||||
#define O_APPEND 0x000008
|
||||
#define O_CREAT 0x000010
|
||||
#define O_DIRECTORY 0x000020
|
||||
#define O_EXCL 0x000040
|
||||
#define O_NOCTTY 0x000080
|
||||
#define O_NOFOLLOW 0x000100
|
||||
#define O_TRUNC 0x000200
|
||||
#define O_NONBLOCK 0x000400
|
||||
#define O_DSYNC 0x000800
|
||||
#define O_RSYNC 0x001000
|
||||
#define O_SYNC 0x002000
|
||||
#define O_CLOEXEC 0x004000
|
||||
#define O_PATH 0x008000
|
||||
#define O_LARGEFILE 0x010000
|
||||
#define O_NOATIME 0x020000
|
||||
#define O_ASYNC 0x040000
|
||||
#define O_TMPFILE 0x080000
|
||||
#define O_DIRECT 0x100000
|
||||
|
||||
/* constants for fcntl()'s command argument */
|
||||
#define F_DUPFD 1
|
||||
#define F_DUPFD_CLOEXEC 2
|
||||
#define F_GETFD 3
|
||||
#define F_SETFD 4
|
||||
#define F_GETFL 5
|
||||
#define F_SETFL 6
|
||||
#define F_GETLK 7
|
||||
#define F_SETLK 8
|
||||
#define F_SETLK64 F_SETLK
|
||||
#define F_SETLKW 9
|
||||
#define F_SETLKW64 F_SETLKW
|
||||
#define F_GETOWN 10
|
||||
#define F_SETOWN 11
|
||||
|
||||
/* constants for struct flock's l_type member */
|
||||
#define F_RDLCK 1
|
||||
#define F_UNLCK 2
|
||||
#define F_WRLCK 3
|
||||
|
||||
/* constants for fcntl()'s additional argument of F_GETFD and F_SETFD */
|
||||
#define FD_CLOEXEC 1
|
||||
|
||||
/* Used by mmap */
|
||||
#define F_SEAL_SHRINK 0x0002
|
||||
#define F_SEAL_GROW 0x0004
|
||||
#define F_SEAL_WRITE 0x0008
|
||||
#define F_SEAL_SEAL 0x0010
|
||||
#define F_SETPIPE_SZ 1031
|
||||
#define F_GETPIPE_SZ 1032
|
||||
#define F_ADD_SEALS 1033
|
||||
#define F_GET_SEALS 1034
|
||||
|
||||
#define AT_EMPTY_PATH 1
|
||||
#define AT_SYMLINK_FOLLOW 2
|
||||
#define AT_SYMLINK_NOFOLLOW 4
|
||||
#define AT_REMOVEDIR 8
|
||||
#define AT_EACCESS 512
|
||||
#define AT_NO_AUTOMOUNT 1024
|
||||
#define AT_STATX_SYNC_AS_STAT 0
|
||||
#define AT_STATX_FORCE_SYNC 2048
|
||||
#define AT_STATX_DONT_SYNC 4096
|
||||
#define AT_STATX_SYNC_TYPE 6144
|
||||
|
||||
#define AT_FDCWD -100
|
||||
|
||||
#define POSIX_FADV_NORMAL 1
|
||||
#define POSIX_FADV_SEQUENTIAL 2
|
||||
#define POSIX_FADV_NOREUSE 3
|
||||
#define POSIX_FADV_DONTNEED 4
|
||||
#define POSIX_FADV_WILLNEED 5
|
||||
#define POSIX_FADV_RANDOM 6
|
||||
|
||||
#endif /* _ABITBITS_FCNTL_H */
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
#ifndef _ABIBITS_GID_T_H
|
||||
#define _ABIBITS_GID_T_H
|
||||
|
||||
typedef unsigned int gid_t;
|
||||
|
||||
#endif /* _ABIBITS_GID_T_H */
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
#ifndef _ABIBITS_IN_H
|
||||
#define _ABIBITS_IN_H
|
||||
|
||||
#include <bits/posix/in_addr_t.h>
|
||||
#include <bits/posix/in_port_t.h>
|
||||
#include <abi-bits/socket.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct in_addr {
|
||||
in_addr_t s_addr;
|
||||
};
|
||||
|
||||
struct sockaddr_in {
|
||||
sa_family_t sin_family;
|
||||
in_port_t sin_port;
|
||||
struct in_addr sin_addr;
|
||||
uint8_t pad[8];
|
||||
};
|
||||
#define sin_zero pad /* for BSD Unix compatibility */
|
||||
|
||||
struct in6_addr {
|
||||
union {
|
||||
uint8_t __s6_addr[16];
|
||||
uint16_t __s6_addr16[8];
|
||||
uint32_t __s6_addr32[4];
|
||||
} __in6_union;
|
||||
};
|
||||
#define s6_addr __in6_union.__s6_addr
|
||||
#define s6_addr16 __in6_union.__s6_addr16
|
||||
#define s6_addr32 __in6_union.__s6_addr32
|
||||
|
||||
struct in6_pktinfo {
|
||||
struct in6_addr ipi6_addr;
|
||||
uint32_t ipi6_ifindex;
|
||||
};
|
||||
|
||||
struct sockaddr_in6 {
|
||||
sa_family_t sin6_family;
|
||||
in_port_t sin6_port;
|
||||
uint32_t sin6_flowinfo;
|
||||
struct in6_addr sin6_addr;
|
||||
uint32_t sin6_scope_id;
|
||||
};
|
||||
|
||||
struct ipv6_mreq {
|
||||
struct in6_addr ipv6mr_multiaddr;
|
||||
unsigned ipv6mr_interface;
|
||||
};
|
||||
|
||||
struct ip_mreq {
|
||||
struct in_addr imr_multiaddr;
|
||||
struct in_addr imr_interface;
|
||||
};
|
||||
|
||||
struct ip_mreq_source {
|
||||
struct in_addr imr_multiaddr;
|
||||
struct in_addr imr_interface;
|
||||
struct in_addr imr_sourceaddr;
|
||||
};
|
||||
|
||||
struct ip_mreqn {
|
||||
struct in_addr imr_multiaddr;
|
||||
struct in_addr imr_address;
|
||||
int imr_ifindex;
|
||||
};
|
||||
|
||||
struct in_pktinfo {
|
||||
unsigned int ipi_ifindex;
|
||||
struct in_addr ipi_spec_dst;
|
||||
struct in_addr ipi_addr;
|
||||
};
|
||||
|
||||
struct group_source_req {
|
||||
uint32_t gsr_interface;
|
||||
struct sockaddr_storage gsr_group;
|
||||
struct sockaddr_storage gsr_source;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
|
||||
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
|
||||
|
||||
#define IPPROTO_IP 1
|
||||
#define IPPROTO_IPV6 2
|
||||
#define IPPROTO_ICMP 3
|
||||
#define IPPROTO_RAW 4
|
||||
#define IPPROTO_TCP 5
|
||||
#define IPPROTO_UDP 6
|
||||
#define IPPROTO_IGMP 7
|
||||
#define IPPROTO_IPIP 8
|
||||
#define IPPROTO_DCCP 33
|
||||
#define IPPROTO_ROUTING 43
|
||||
#define IPPROTO_GRE 47
|
||||
#define IPPROTO_ESP 50
|
||||
#define IPPROTO_AH 51
|
||||
#define IPPROTO_ICMPV6 58
|
||||
#define IPPROTO_DSTOPTS 60
|
||||
#define IPPROTO_COMP 108
|
||||
#define IPPROTO_SCTP 132
|
||||
#define IPPROTO_UDPLITE 136
|
||||
#define IPPROTO_MAX 256
|
||||
|
||||
#define INADDR_ANY ((in_addr_t)0x00000000)
|
||||
#define INADDR_BROADCAST ((in_addr_t)0xffffffff)
|
||||
#define INADDR_LOOPBACK ((in_addr_t)0x7f000001)
|
||||
#define INADDR_NONE ((in_addr_t)0xffffffff)
|
||||
|
||||
#define INET_ADDRSTRLEN 16
|
||||
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
|
||||
#define IPV6_JOIN_GROUP 1
|
||||
#define IPV6_LEAVE_GROUP 2
|
||||
#define IPV6_MULTICAST_HOPS 3
|
||||
#define IPV6_MULTICAST_IF 4
|
||||
#define IPV6_MULTICAST_LOOP 5
|
||||
#define IPV6_UNICAST_HOPS 6
|
||||
#define IPV6_V6ONLY 7
|
||||
#define IPV6_PMTUDISC_DONT 8
|
||||
#define IPV6_PMTUDISC_DO 9
|
||||
#define IPV6_MTU 10
|
||||
#define IPV6_2292PKTOPTIONS 11
|
||||
#define IPV6_MTU_DISCOVER 23
|
||||
#define IPV6_RECVERR 25
|
||||
#define IPV6_RECVPKTINFO 49
|
||||
#define IPV6_PKTINFO 50
|
||||
#define IPV6_RECVHOPLIMIT 51
|
||||
#define IPV6_HOPLIMIT 52
|
||||
#define IPV6_TCLASS 67
|
||||
|
||||
#define IP_TOS 1
|
||||
#define IP_TTL 2
|
||||
#define IP_OPTIONS 4
|
||||
#define IP_PMTUDISC_OMIT 5
|
||||
#define IP_PKTINFO 8
|
||||
#define IP_PKTOPTIONS 9
|
||||
#define IP_MTU_DISCOVER 10
|
||||
#define IP_RECVERR 11
|
||||
#define IP_RECVTTL 12
|
||||
#define IP_UNICAST_IF 13
|
||||
#define IP_MTU 14
|
||||
|
||||
#define IP_DEFAULT_MULTICAST_TTL 1
|
||||
#define IP_MULTICAST_IF 32
|
||||
#define IP_MULTICAST_TTL 33
|
||||
#define IP_MULTICAST_LOOP 34
|
||||
#define IP_ADD_MEMBERSHIP 35
|
||||
#define IP_DROP_MEMBERSHIP 36
|
||||
#define IP_UNBLOCK_SOURCE 37
|
||||
#define IP_BLOCK_SOURCE 38
|
||||
#define IP_ADD_SOURCE_MEMBERSHIP 39
|
||||
#define IP_DROP_SOURCE_MEMBERSHIP 40
|
||||
#define MCAST_JOIN_SOURCE_GROUP 46
|
||||
#define MCAST_LEAVE_SOURCE_GROUP 47
|
||||
|
||||
#define IP_PMTUDISC_DONT 0
|
||||
#define IP_PMTUDISC_DO 2
|
||||
|
||||
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
|
||||
#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
|
||||
|
||||
#endif /* _ABIBITS_IN_H */
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
#ifndef _ABIBITS_INO_T_H
|
||||
#define _ABIBITS_INO_T_H
|
||||
|
||||
/* TODO: use (u)int64_t? */
|
||||
typedef long ino_t;
|
||||
|
||||
#endif /* _ABIBITS_INO_T_H */
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef _ABIBITS_INOTIFY_H
|
||||
#define _ABIBITS_INOTIFY_H
|
||||
|
||||
#define IN_CLOEXEC 1
|
||||
#define IN_NONBLOCK 2
|
||||
|
||||
#endif /* _ABIBITS_INOTIFY_H */
|
||||
@@ -0,0 +1,51 @@
|
||||
#ifndef _ABIBITS_IPC_H
|
||||
#define _ABIBITS_IPC_H
|
||||
|
||||
#include <abi-bits/uid_t.h>
|
||||
#include <abi-bits/gid_t.h>
|
||||
#include <abi-bits/mode_t.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define IPC_CREAT 01000
|
||||
#define IPC_EXCL 02000
|
||||
#define IPC_NOWAIT 04000
|
||||
|
||||
#define IPC_RMID 0
|
||||
#define IPC_SET 1
|
||||
#define IPC_STAT 2
|
||||
#define IPC_INFO 3
|
||||
|
||||
#define IPC_PRIVATE ((key_t) 0)
|
||||
|
||||
#if defined(__aarch64__) || defined(__i386__) || defined(__m68k__)
|
||||
#define IPC_64 0x100
|
||||
#elif defined(__x86_64__) || (defined(__riscv) && __riscv_xlen == 64) || defined(__loongarch64)
|
||||
#define IPC_64 0
|
||||
#else
|
||||
#error "Unsupported arch!"
|
||||
#endif
|
||||
|
||||
typedef int key_t;
|
||||
|
||||
struct ipc64_perm {
|
||||
key_t __ipc_perm_key;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
uid_t cuid;
|
||||
gid_t cgid;
|
||||
mode_t mode;
|
||||
short __ipc_perm_seq;
|
||||
short __pad;
|
||||
unsigned long __unused[2];
|
||||
};
|
||||
|
||||
#define ipc_perm ipc64_perm
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef _ABIBITS_LIMITS_H
|
||||
#define _ABIBITS_LIMITS_H
|
||||
|
||||
#define IOV_MAX 1024
|
||||
|
||||
/* Niceness related */
|
||||
#define NZERO 20
|
||||
|
||||
/* Maximum hostname length, posix defines it as 255 */
|
||||
#define HOST_NAME_MAX 255
|
||||
|
||||
#define OPEN_MAX 256
|
||||
|
||||
#endif /*_ABIBITS_LIMITS_H */
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
#ifndef _ABIBITS_MODE_T_H
|
||||
#define _ABIBITS_MODE_T_H
|
||||
|
||||
typedef int mode_t;
|
||||
|
||||
#endif /* _ABIBITS_MODE_T_H */
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
#ifndef _ABIBITS_NLINK_T_H
|
||||
#define _ABIBITS_NLINK_T_H
|
||||
|
||||
typedef int nlink_t;
|
||||
|
||||
#endif /* _ABIBITS_NLINK_T_H */
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef _ABIBITS_PACKET_H
|
||||
#define _ABIBITS_PACKET_H
|
||||
|
||||
#define PACKET_HOST 0
|
||||
|
||||
#endif /* _ABIBITS_PACKET_H */
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
#ifndef _ABIBITS_PID_T_H
|
||||
#define _ABIBITS_PID_T_H
|
||||
|
||||
typedef int pid_t;
|
||||
|
||||
#endif /* _ABIBITS_PID_T_H */
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef _ABIBITS_POLL_H
|
||||
#define _ABIBITS_POLL_H
|
||||
|
||||
#define POLLIN 0x01
|
||||
#define POLLOUT 0x02
|
||||
#define POLLPRI 0x04
|
||||
#define POLLHUP 0x08
|
||||
#define POLLERR 0x10
|
||||
#define POLLRDHUP 0x20
|
||||
#define POLLNVAL 0x40
|
||||
#define POLLWRNORM 0x80
|
||||
#define POLLRDNORM 0x100
|
||||
#define POLLWRBAND 0x200
|
||||
#define POLLRDBAND 0x400
|
||||
|
||||
#endif /* _ABIBITS_POLL_H */
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef _ABIBITS_PTRACE_H
|
||||
#define _ABIBITS_PTRACE_H
|
||||
|
||||
#define PTRACE_PEEKTEXT 1
|
||||
#define PTRACE_PEEKDATA 2
|
||||
#define PTRACE_PEEKUSER 3
|
||||
#define PTRACE_POKETEXT 4
|
||||
#define PTRACE_POKEDATA 5
|
||||
#define PTRACE_CONT 7
|
||||
#define PTRACE_KILL 8
|
||||
#define PTRACE_SINGLESTEP 9
|
||||
#define PTRACE_GETREGS 14
|
||||
#define PTRACE_SETREGS 15
|
||||
#define PTRACE_ATTACH 16
|
||||
#define PTRACE_DETACH 17
|
||||
#define PTRACE_GETFPXREGS 18
|
||||
#define PTRACE_SETFPXREGS 19
|
||||
#define PTRACE_GETFPREGS 20
|
||||
#define PTRACE_SYSCALL 24
|
||||
#define PTRACE_SETOPTIONS 0x4200
|
||||
#define PTRACE_GETEVENTMSG 0x4201
|
||||
#define PTRACE_GETSIGINFO 0x4202
|
||||
#define PTRACE_SETSIGINFO 0x4203
|
||||
#define PTRACE_GETREGSET 0x4204
|
||||
#define PTRACE_SETREGSET 0x4205
|
||||
#define PTRACE_SEIZE 0x4206
|
||||
#define PTRACE_INTERRUPT 0x4207
|
||||
#define PTRACE_LISTEN 0x4208
|
||||
#define PTRACE_PEEKSIGINFO 0x4209
|
||||
#define PTRACE_GETSIGMASK 0x420A
|
||||
#define PTRACE_SETSIGMASK 0x420B
|
||||
#define PTRACE_SECCOMP_GET_FILTER 0x420C
|
||||
|
||||
#define PTRACE_CE_O_TRACESYSGOOD 0x00000001
|
||||
#define PTRACE_O_TRACEFORK 0x00000002
|
||||
#define PTRACE_O_TRACEVFORK 0x00000004
|
||||
#define PTRACE_O_TRACECLONE 0x00000008
|
||||
#define PTRACE_O_TRACEEXEC 0x00000010
|
||||
#define PTRACE_O_TRACEVFORKDONE 0x00000020
|
||||
#define PTRACE_O_TRACEEXIT 0x00000040
|
||||
#define PTRACE_O_TRACESECCOMP 0x00000080
|
||||
#define PTRACE_O_EXITKILL 0x00100000
|
||||
#define PTRACE_O_SUSPEND_SECCOMP 0x00200000
|
||||
#define PTRACE_O_MASK 0x003000ff
|
||||
|
||||
#define PTRACE_EVENT_FORK 1
|
||||
#define PTRACE_EVENT_VFORK 2
|
||||
#define PTRACE_EVENT_CLONE 3
|
||||
#define PTRACE_EVENT_EXEC 4
|
||||
#define PTRACE_EVENT_VFORK_DONE 5
|
||||
#define PTRACE_EVENT_EXIT 6
|
||||
#define PTRACE_EVENT_SECCOMP 7
|
||||
|
||||
#define PTRACE_PEEKSIGINFO_SHARED 1
|
||||
|
||||
#endif /* _ABIBITS_PTRACE_H */
|
||||
@@ -0,0 +1,53 @@
|
||||
#ifndef _ABIBITS_RESOURCE_H
|
||||
#define _ABIBITS_RESOURCE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bits/posix/timeval.h>
|
||||
|
||||
#define RUSAGE_SELF 1
|
||||
#define RUSAGE_CHILDREN 2
|
||||
|
||||
#define RLIMIT_CORE 1
|
||||
#define RLIMIT_CPU 2
|
||||
#define RLIMIT_DATA 3
|
||||
#define RLIMIT_FSIZE 4
|
||||
#define RLIMIT_NOFILE 5
|
||||
#define RLIMIT_STACK 6
|
||||
#define RLIMIT_AS 7
|
||||
#define RLIMIT_MEMLOCK 8
|
||||
#define RLIMIT_RSS 9
|
||||
#define RLIMIT_NPROC 10
|
||||
#define RLIMIT_LOCKS 11
|
||||
#define RLIMIT_SIGPENDING 12
|
||||
#define RLIMIT_MSGQUEUE 13
|
||||
#define RLIMIT_NICE 14
|
||||
#define RLIMIT_RTPRIO 15
|
||||
#define RLIMIT_NLIMITS 16
|
||||
|
||||
struct rusage {
|
||||
struct timeval ru_utime;
|
||||
struct timeval ru_stime;
|
||||
long int ru_maxrss;
|
||||
long int ru_ixrss;
|
||||
long int ru_idrss;
|
||||
long int ru_isrss;
|
||||
long int ru_minflt;
|
||||
long int ru_majflt;
|
||||
long int ru_nswap;
|
||||
long int ru_inblock;
|
||||
long int ru_oublock;
|
||||
long int ru_msgsnd;
|
||||
long int ru_msgrcv;
|
||||
long int ru_nsignals;
|
||||
long int ru_nvcsw;
|
||||
long int ru_nivcsw;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ABIBITS_RESOURCE_H */
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef _ABIBITS_RLIM_T_H
|
||||
#define _ABIBITS_RLIM_T_H
|
||||
|
||||
typedef unsigned long long rlim_t;
|
||||
|
||||
#endif /* _ABIBITS_RLIM_T_H */
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef _ABIBITS_SEEK_WHENCE_H
|
||||
#define _ABIBITS_SEEK_WHENCE_H
|
||||
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
#define SEEK_SET 3
|
||||
#define SEEK_DATA 4
|
||||
#define SEEK_HOLE 5
|
||||
|
||||
#endif /* _ABIBITS_SEEK_WHENCE_H */
|
||||
@@ -0,0 +1,84 @@
|
||||
#ifndef _ABIBITS_SHM_H
|
||||
#define _ABIBITS_SHM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bits/ansi/time_t.h>
|
||||
#include <abi-bits/pid_t.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/ipc.h>
|
||||
|
||||
#define SHM_R 0400
|
||||
#define SHM_W 0200
|
||||
|
||||
#define SHM_RDONLY 010000
|
||||
#define SHM_RND 020000
|
||||
#define SHM_REMAP 040000
|
||||
#define SHM_EXEC 0100000
|
||||
|
||||
#define SHM_LOCK 11
|
||||
#define SHM_UNLOCK 12
|
||||
#define SHM_STAT 13
|
||||
#define SHM_INFO 14
|
||||
#define SHM_STAT_ANY 15
|
||||
#define SHM_DEST 01000
|
||||
#define SHM_LOCKED 02000
|
||||
#define SHM_HUGETLB 04000
|
||||
#define SHM_NORESERVE 010000
|
||||
|
||||
#define SHM_HUGE_SHIFT 26
|
||||
#define SHM_HUGE_MASK 0x3f
|
||||
#define SHM_HUGE_64KB (16 << 26)
|
||||
#define SHM_HUGE_512KB (19 << 26)
|
||||
#define SHM_HUGE_1MB (20 << 26)
|
||||
#define SHM_HUGE_2MB (21 << 26)
|
||||
#define SHM_HUGE_8MB (23 << 26)
|
||||
#define SHM_HUGE_16MB (24 << 26)
|
||||
#define SHM_HUGE_32MB (25 << 26)
|
||||
#define SHM_HUGE_256MB (28 << 26)
|
||||
#define SHM_HUGE_512MB (29 << 26)
|
||||
#define SHM_HUGE_1GB (30 << 26)
|
||||
#define SHM_HUGE_2GB (31 << 26)
|
||||
#define SHM_HUGE_16GB (34U << 26)
|
||||
|
||||
typedef unsigned long shmatt_t;
|
||||
|
||||
struct shmid_ds {
|
||||
struct ipc_perm shm_perm;
|
||||
size_t shm_segsz;
|
||||
time_t shm_atime;
|
||||
time_t shm_dtime;
|
||||
time_t shm_ctime;
|
||||
pid_t shm_cpid;
|
||||
pid_t shm_lpid;
|
||||
unsigned long shm_nattch;
|
||||
};
|
||||
|
||||
struct shminfo {
|
||||
unsigned long shmmax;
|
||||
unsigned long shmmin;
|
||||
unsigned long shmmni;
|
||||
unsigned long shmseg;
|
||||
unsigned long shmall;
|
||||
unsigned long __unused[4];
|
||||
};
|
||||
|
||||
struct shm_info {
|
||||
int used_ids;
|
||||
unsigned long shm_tot;
|
||||
unsigned long shm_rss;
|
||||
unsigned long shm_swp;
|
||||
unsigned long swap_attempts;
|
||||
unsigned long swap_successes;
|
||||
};
|
||||
|
||||
#define SHMLBA (getpagesize())
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ABIBITS_SHM_H */
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef _ABIBITS_SIGEVENT_H
|
||||
#define _ABIBITS_SIGEVENT_H
|
||||
|
||||
#include <abi-bits/sigval.h>
|
||||
#include <abi-bits/pid_t.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct sigevent {
|
||||
int sigev_notify;
|
||||
int sigev_signo;
|
||||
union sigval sigev_value;
|
||||
void (*sigev_notify_function)(union sigval);
|
||||
/* MISSING: sigev_notify_attributes */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ABIBITS_SIGEVENT_H */
|
||||
@@ -0,0 +1,184 @@
|
||||
#ifndef _ABIBITS_SIGNAL_H
|
||||
#define _ABIBITS_SIGNAL_H
|
||||
|
||||
#if __MLIBC_BUILDING_MLIBC
|
||||
#warning signal.h is a broken header originally from the deprecated "mlibc" ABI. \
|
||||
We suggest to use abis/linux/signal.h instead. \
|
||||
Note that this will potentially require kernel changes.
|
||||
#endif
|
||||
|
||||
#include <abi-bits/pid_t.h>
|
||||
#include <abi-bits/uid_t.h>
|
||||
#include <abi-bits/sigevent.h>
|
||||
#include <bits/types.h>
|
||||
#include <bits/size_t.h>
|
||||
|
||||
typedef struct {
|
||||
int si_signo;
|
||||
int si_code;
|
||||
int si_errno;
|
||||
pid_t si_pid;
|
||||
uid_t si_uid;
|
||||
void *si_addr;
|
||||
int si_status;
|
||||
union sigval si_value;
|
||||
} siginfo_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Argument for signal() */
|
||||
typedef void (*__sighandler) (int);
|
||||
|
||||
#define SIG_ERR ((__sighandler)(void *)(-1))
|
||||
#define SIG_DFL ((__sighandler)(void *)(-2))
|
||||
#define SIG_IGN ((__sighandler)(void *)(-3))
|
||||
|
||||
#define SIGHUP 1
|
||||
#define SIGINT 2
|
||||
#define SIGQUIT 3
|
||||
#define SIGILL 4
|
||||
#define SIGTRAP 5
|
||||
#define SIGABRT 6
|
||||
#define SIGBUS 7
|
||||
#define SIGFPE 8
|
||||
#define SIGKILL 9
|
||||
#define SIGUSR1 10
|
||||
#define SIGSEGV 11
|
||||
#define SIGUSR2 12
|
||||
#define SIGPIPE 13
|
||||
#define SIGALRM 14
|
||||
#define SIGTERM 15
|
||||
#define SIGSTKFLT 16
|
||||
#define SIGCHLD 17
|
||||
#define SIGCONT 18
|
||||
#define SIGSTOP 19
|
||||
#define SIGTSTP 20
|
||||
#define SIGTTIN 21
|
||||
#define SIGTTOU 22
|
||||
#define SIGURG 23
|
||||
#define SIGXCPU 24
|
||||
#define SIGXFSZ 25
|
||||
#define SIGVTALRM 26
|
||||
#define SIGPROF 27
|
||||
#define SIGWINCH 28
|
||||
#define SIGIO 29
|
||||
#define SIGPOLL SIGIO
|
||||
#define SIGPWR 30
|
||||
#define SIGSYS 31
|
||||
#define SIGRTMIN 32
|
||||
#define SIGRTMAX 33
|
||||
#define SIGCANCEL 34
|
||||
|
||||
/* siginfo->si_info constants */
|
||||
/* SIGBUS */
|
||||
#define BUS_ADRALN 1
|
||||
#define BUS_ADRERR 2
|
||||
#define BUS_OBJERR 3
|
||||
|
||||
/* SIGILL */
|
||||
#define ILL_ILLOPC 1
|
||||
#define ILL_ILLOPN 2
|
||||
#define ILL_ILLADR 3
|
||||
#define ILL_ILLTRP 4
|
||||
#define ILL_PRVOPC 5
|
||||
#define ILL_PRVREG 6
|
||||
#define ILL_COPROC 7
|
||||
#define ILL_BADSTK 8
|
||||
#define ILL_BADIADDR 9
|
||||
|
||||
/* SIGSEGV */
|
||||
#define SEGV_MAPERR 1
|
||||
#define SEGV_ACCERR 2
|
||||
|
||||
typedef __mlibc_uint64 sigset_t;
|
||||
|
||||
#define SIGUNUSED SIGSYS
|
||||
|
||||
/* constants for sigprocmask() */
|
||||
#define SIG_BLOCK 1
|
||||
#define SIG_UNBLOCK 2
|
||||
#define SIG_SETMASK 3
|
||||
|
||||
#define SA_NOCLDSTOP (1 << 0)
|
||||
#define SA_ONSTACK (1 << 1)
|
||||
#define SA_RESETHAND (1 << 2)
|
||||
#define SA_RESTART (1 << 3)
|
||||
#define SA_SIGINFO (1 << 4)
|
||||
#define SA_NOCLDWAIT (1 << 5)
|
||||
#define SA_NODEFER (1 << 6)
|
||||
|
||||
#define MINSIGSTKSZ 2048
|
||||
#define SIGSTKSZ 8192
|
||||
#define SS_ONSTACK 1
|
||||
#define SS_DISABLE 2
|
||||
|
||||
typedef struct __stack {
|
||||
void *ss_sp;
|
||||
size_t ss_size;
|
||||
int ss_flags;
|
||||
} stack_t;
|
||||
|
||||
/* constants for sigev_notify of struct sigevent */
|
||||
#define SIGEV_NONE 1
|
||||
#define SIGEV_SIGNAL 2
|
||||
#define SIGEV_THREAD 3
|
||||
|
||||
#define SI_ASYNCNL (-60)
|
||||
#define SI_TKILL (-6)
|
||||
#define SI_SIGIO (-5)
|
||||
#define SI_ASYNCIO (-4)
|
||||
#define SI_MESGQ (-3)
|
||||
#define SI_TIMER (-2)
|
||||
#define SI_QUEUE (-1)
|
||||
#define SI_USER 0
|
||||
#define SI_KERNEL 128
|
||||
|
||||
#define NSIG 65
|
||||
#define _NSIG NSIG
|
||||
|
||||
#define CLD_EXITED 1
|
||||
#define CLD_KILLED 2
|
||||
#define CLD_DUMPED 3
|
||||
#define CLD_TRAPPED 4
|
||||
#define CLD_STOPPED 5
|
||||
#define CLD_CONTINUED 6
|
||||
|
||||
struct sigaction {
|
||||
void (*sa_handler)(int);
|
||||
sigset_t sa_mask;
|
||||
int sa_flags;
|
||||
void (*sa_sigaction)(int, siginfo_t *, void *);
|
||||
};
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
|
||||
/* TODO: This is wrong for AArch64. */
|
||||
|
||||
typedef struct {
|
||||
unsigned long oldmask;
|
||||
unsigned long gregs[16];
|
||||
unsigned long pc, pr, sr;
|
||||
unsigned long gbr, mach, macl;
|
||||
unsigned long fpregs[16];
|
||||
unsigned long xfpregs[16];
|
||||
unsigned int fpscr, fpul, ownedfp;
|
||||
} mcontext_t;
|
||||
|
||||
typedef struct __ucontext {
|
||||
unsigned long uc_flags;
|
||||
struct __ucontext *uc_link;
|
||||
stack_t uc_stack;
|
||||
mcontext_t uc_mcontext;
|
||||
sigset_t uc_sigmask;
|
||||
} ucontext_t;
|
||||
|
||||
#else
|
||||
#error "Missing architecture specific code."
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ABIBITS_SIGNAL_H */
|
||||
@@ -0,0 +1,165 @@
|
||||
#ifndef _ABIBITS_SOCKET_H
|
||||
#define _ABIBITS_SOCKET_H
|
||||
|
||||
#include <abi-bits/socklen_t.h>
|
||||
#include <bits/posix/iovec.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef unsigned int sa_family_t;
|
||||
|
||||
struct msghdr {
|
||||
void *msg_name;
|
||||
socklen_t msg_namelen;
|
||||
struct iovec *msg_iov;
|
||||
int msg_iovlen;
|
||||
void *msg_control;
|
||||
socklen_t msg_controllen;
|
||||
int msg_flags;
|
||||
};
|
||||
|
||||
struct sockaddr_storage {
|
||||
sa_family_t ss_family;
|
||||
char __padding[128 - sizeof(sa_family_t)];
|
||||
};
|
||||
|
||||
struct mmsghdr {
|
||||
struct msghdr msg_hdr;
|
||||
unsigned int msg_len;
|
||||
};
|
||||
|
||||
struct cmsghdr {
|
||||
socklen_t cmsg_len;
|
||||
int cmsg_level;
|
||||
int cmsg_type;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SCM_RIGHTS 1
|
||||
#define SCM_TIMESTAMP SO_TIMESTAMP
|
||||
#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
|
||||
|
||||
/*MISSING: CMSG_DATA, CMSG_NXTHDR, CMSG_FIRSTHDR */
|
||||
|
||||
#define SCM_CREDENTIALS 0x02
|
||||
|
||||
#define SOCK_DGRAM 1
|
||||
#define SOCK_RAW 2
|
||||
#define SOCK_SEQPACKET 3
|
||||
#define SOCK_STREAM 4
|
||||
#define SOCK_DCCP 5
|
||||
#define SOCK_NONBLOCK 0x10000
|
||||
#define SOCK_CLOEXEC 0x20000
|
||||
#define SOCK_RDM 0x40000
|
||||
|
||||
#define SOL_SOCKET 1
|
||||
#define SOL_IPV6 41
|
||||
#define SOL_PACKET 263
|
||||
#define SOL_NETLINK 270
|
||||
|
||||
#define SO_ACCEPTCONN 1
|
||||
#define SO_BROADCAST 2
|
||||
#define SO_DEBUG 3
|
||||
#define SO_DONTROUTE 4
|
||||
#define SO_ERROR 5
|
||||
#define SO_KEEPALIVE 6
|
||||
#define SO_LINGER 7
|
||||
#define SO_OOBINLINE 8
|
||||
#define SO_RCVBUF 9
|
||||
#define SO_RCVLOWAT 10
|
||||
#define SO_RCVTIMEO 11
|
||||
#define SO_REUSEADDR 12
|
||||
#define SO_SNDBUF 13
|
||||
#define SO_SNDLOWAT 14
|
||||
#define SO_SNDTIMEO 15
|
||||
#define SO_TYPE 16
|
||||
#define SO_SNDBUFFORCE 17
|
||||
#define SO_PEERCRED 18
|
||||
#define SO_ATTACH_FILTER 19
|
||||
#define SO_PASSCRED 20
|
||||
#define SO_RCVBUFFORCE 21
|
||||
#define SO_DETACH_FILTER 22
|
||||
#define SO_PROTOCOL 23
|
||||
#define SO_REUSEPORT 24
|
||||
#define SO_TIMESTAMP 25
|
||||
#define SO_PEERSEC 26
|
||||
#define SO_BINDTODEVICE 27
|
||||
#define SO_DOMAIN 28
|
||||
#define SO_PASSSEC 29
|
||||
#define SO_TIMESTAMPNS 30
|
||||
#define SO_PRIORITY 31
|
||||
#define SO_MARK 32
|
||||
|
||||
#define SOMAXCONN 1
|
||||
|
||||
#define MSG_CTRUNC 0x1
|
||||
#define MSG_DONTROUTE 0x2
|
||||
#define MSG_EOR 0x4
|
||||
#define MSG_OOB 0x8
|
||||
#define MSG_NOSIGNAL 0x10
|
||||
#define MSG_PEEK 0x20
|
||||
#define MSG_TRUNC 0x40
|
||||
#define MSG_WAITALL 0x80
|
||||
#define MSG_FIN 0x200
|
||||
#define MSG_CONFIRM 0x800
|
||||
|
||||
/* Linux extensions. */
|
||||
#define MSG_DONTWAIT 0x1000
|
||||
#define MSG_CMSG_CLOEXEC 0x2000
|
||||
#define MSG_MORE 0x4000
|
||||
#define MSG_FASTOPEN 0x20000000
|
||||
|
||||
/* GNU (?) extension: Protocol family constants. */
|
||||
|
||||
#define PF_INET 1
|
||||
#define PF_INET6 2
|
||||
#define PF_UNIX 3
|
||||
#define PF_LOCAL 3
|
||||
#define PF_UNSPEC 4
|
||||
#define PF_NETLINK 5
|
||||
#define PF_BRIDGE 6
|
||||
#define PF_APPLETALK 7
|
||||
#define PF_BLUETOOTH 8
|
||||
#define PF_DECnet 9
|
||||
#define PF_IPX 10
|
||||
#define PF_ISDN 11
|
||||
#define PF_SNA 12
|
||||
#define PF_PACKET 13
|
||||
#define PF_AX25 14
|
||||
#define PF_NETROM 15
|
||||
#define PF_ROSE 16
|
||||
#define PF_TIPC 30
|
||||
#define PF_ALG 38
|
||||
#define PF_MAX 46
|
||||
|
||||
#define AF_INET PF_INET
|
||||
#define AF_INET6 PF_INET6
|
||||
#define AF_UNIX PF_UNIX
|
||||
#define AF_LOCAL PF_LOCAL
|
||||
#define AF_UNSPEC PF_UNSPEC
|
||||
#define AF_NETLINK PF_NETLINK
|
||||
#define AF_BRIDGE PF_BRIDGE
|
||||
#define AF_APPLETALK PF_APPLETALK
|
||||
#define AF_BLUETOOTH PF_BLUETOOTH
|
||||
#define AF_DECnet PF_DECnet
|
||||
#define AF_IPX PF_IPX
|
||||
#define AF_ISDN PF_ISDN
|
||||
#define AF_SNA PF_SNA
|
||||
#define AF_PACKET PF_PACKET
|
||||
#define AF_PACKET PF_PACKET
|
||||
#define AF_AX25 PF_AX25
|
||||
#define AF_NETROM PF_NETROM
|
||||
#define AF_ROSE PF_ROSE
|
||||
#define AF_TIPC PF_TIPC
|
||||
#define AF_ALG PF_ALG
|
||||
#define AF_MAX PF_MAX
|
||||
|
||||
#define SHUT_RD 1
|
||||
#define SHUT_RDWR 2
|
||||
#define SHUT_WR 3
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
#ifndef _ABIBITS_STAT_H
|
||||
#define _ABIBITS_STAT_H
|
||||
|
||||
#include <abi-bits/uid_t.h>
|
||||
#include <abi-bits/gid_t.h>
|
||||
#include <bits/off_t.h>
|
||||
#include <abi-bits/mode_t.h>
|
||||
#include <abi-bits/dev_t.h>
|
||||
#include <abi-bits/ino_t.h>
|
||||
#include <abi-bits/blksize_t.h>
|
||||
#include <abi-bits/blkcnt_t.h>
|
||||
#include <abi-bits/nlink_t.h>
|
||||
#include <bits/ansi/time_t.h>
|
||||
#include <bits/ansi/timespec.h>
|
||||
|
||||
#define S_IFMT 0x0F000
|
||||
#define S_IFBLK 0x06000
|
||||
#define S_IFCHR 0x02000
|
||||
#define S_IFIFO 0x01000
|
||||
#define S_IFREG 0x08000
|
||||
#define S_IFDIR 0x04000
|
||||
#define S_IFLNK 0x0A000
|
||||
#define S_IFSOCK 0x0C000
|
||||
|
||||
#define S_IRWXU 0700
|
||||
#define S_IRUSR 0400
|
||||
#define S_IWUSR 0200
|
||||
#define S_IXUSR 0100
|
||||
#define S_IRWXG 070
|
||||
#define S_IRGRP 040
|
||||
#define S_IWGRP 020
|
||||
#define S_IXGRP 010
|
||||
#define S_IRWXO 07
|
||||
#define S_IROTH 04
|
||||
#define S_IWOTH 02
|
||||
#define S_IXOTH 01
|
||||
#define S_ISUID 04000
|
||||
#define S_ISGID 02000
|
||||
#define S_ISVTX 01000
|
||||
|
||||
#define S_IREAD S_IRUSR
|
||||
#define S_IWRITE S_IWUSR
|
||||
#define S_IEXEC S_IXUSR
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct stat {
|
||||
dev_t st_dev;
|
||||
ino_t st_ino;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
dev_t st_rdev;
|
||||
off_t st_size;
|
||||
struct timespec st_atim;
|
||||
struct timespec st_mtim;
|
||||
struct timespec st_ctim;
|
||||
blksize_t st_blksize;
|
||||
blkcnt_t st_blocks;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ABIBITS_STAT_H */
|
||||
@@ -0,0 +1,119 @@
|
||||
#ifndef _ABIBITS_TERMIOS_H
|
||||
#define _ABIBITS_TERMIOS_H
|
||||
|
||||
#if __MLIBC_BUILDING_MLIBC
|
||||
#warning termios.h is a broken header originally from the deprecated "mlibc" ABI. \
|
||||
We suggest to use abis/linux/termios.h instead. \
|
||||
Note that this will potentially require kernel changes.
|
||||
#endif
|
||||
|
||||
typedef unsigned int cc_t;
|
||||
typedef unsigned int speed_t;
|
||||
typedef unsigned int tcflag_t;
|
||||
|
||||
/* indices for the c_cc array in struct termios */
|
||||
#define NCCS 11
|
||||
#define VEOF 0
|
||||
#define VEOL 1
|
||||
#define VERASE 2
|
||||
#define VINTR 3
|
||||
#define VKILL 4
|
||||
#define VMIN 5
|
||||
#define VQUIT 6
|
||||
#define VSTART 7
|
||||
#define VSTOP 8
|
||||
#define VSUSP 9
|
||||
#define VTIME 10
|
||||
|
||||
/* bitwise flags for c_iflag in struct termios */
|
||||
#define BRKINT 0x0001
|
||||
#define ICRNL 0x0002
|
||||
#define IGNBRK 0x0004
|
||||
#define IGNCR 0x0008
|
||||
#define IGNPAR 0x0010
|
||||
#define INLCR 0x0020
|
||||
#define INPCK 0x0040
|
||||
#define ISTRIP 0x0080
|
||||
#define IXANY 0x0100
|
||||
#define IXOFF 0x0200
|
||||
#define IXON 0x0400
|
||||
#define PARMRK 0x0800
|
||||
|
||||
/* bitwise flags for c_oflag in struct termios */
|
||||
#define OPOST 0x0001
|
||||
#define ONLCR 0x0002
|
||||
#define OCRNL 0x0004
|
||||
#define ONOCR 0x0008
|
||||
#define ONLRET 0x0010
|
||||
#define OFDEL 0x0020
|
||||
#define OFILL 0x0040
|
||||
|
||||
#define NLDLY 0x0080
|
||||
#define NL0 0x0000
|
||||
#define NL1 0x0080
|
||||
|
||||
#define CRDLY 0x0300
|
||||
#define CR0 0x0000
|
||||
#define CR1 0x0100
|
||||
#define CR2 0x0200
|
||||
#define CR3 0x0300
|
||||
|
||||
#define TABDLY 0x0C00
|
||||
#define TAB0 0x0000
|
||||
#define TAB1 0x0400
|
||||
#define TAB2 0x0800
|
||||
#define TAB3 0x0C00
|
||||
|
||||
#define BSDLY 0x1000
|
||||
#define BS0 0x0000
|
||||
#define BS1 0x1000
|
||||
|
||||
#define VTDLY 0x2000
|
||||
#define VT0 0x0000
|
||||
#define VT1 0x2000
|
||||
|
||||
#define FFDLY 0x4000
|
||||
#define FF0 0x0000
|
||||
#define FF1 0x4000
|
||||
|
||||
/* bitwise constants for c_cflag in struct termios */
|
||||
#define CSIZE 0x0003
|
||||
#define CS5 0x0000
|
||||
#define CS6 0x0001
|
||||
#define CS7 0x0002
|
||||
#define CS8 0x0003
|
||||
|
||||
#define CSTOPB 0x0004
|
||||
#define CREAD 0x0008
|
||||
#define PARENB 0x0010
|
||||
#define PARODD 0x0020
|
||||
#define HUPCL 0x0040
|
||||
#define CLOCAL 0x0080
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#define CBAUD 0x100F
|
||||
#endif
|
||||
|
||||
/* bitwise constants for c_lflag in struct termios */
|
||||
#define ECHO 0x0001
|
||||
#define ECHOE 0x0002
|
||||
#define ECHOK 0x0004
|
||||
#define ECHONL 0x0008
|
||||
#define ICANON 0x0010
|
||||
#define IEXTEN 0x0020
|
||||
#define ISIG 0x0040
|
||||
#define NOFLSH 0x0080
|
||||
#define TOSTOP 0x0100
|
||||
#define ECHOPRT 0x0200
|
||||
|
||||
struct termios {
|
||||
tcflag_t c_iflag;
|
||||
tcflag_t c_oflag;
|
||||
tcflag_t c_cflag;
|
||||
tcflag_t c_lflag;
|
||||
cc_t c_cc[NCCS];
|
||||
speed_t ibaud;
|
||||
speed_t obaud;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
#ifndef _ABIBITS_UID_T_H
|
||||
#define _ABIBITS_UID_T_H
|
||||
|
||||
typedef unsigned int uid_t;
|
||||
|
||||
#endif /* _ABIBITS_UID_T_H */
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef _ABIBITS_UTSNAME_T_H
|
||||
#define _ABIBITS_UTSNAME_T_H
|
||||
|
||||
#if __MLIBC_BUILDING_MLIBC
|
||||
#warning utsname.h is a broken header originally from the deprecated "mlibc" ABI. \
|
||||
We suggest to use abis/linux/utsname.h instead. \
|
||||
Note that this will potentially require kernel changes.
|
||||
#endif
|
||||
|
||||
struct utsname {
|
||||
char sysname[65];
|
||||
char nodename[65];
|
||||
char release[65];
|
||||
char version[65];
|
||||
char machine[65];
|
||||
};
|
||||
|
||||
#endif /* _ABIBITS_UTSNAME_T_H */
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef _ABIBITS_MMAP_FLAGS_H
|
||||
#define _ABIBITS_MMAP_FLAGS_H
|
||||
|
||||
#define PROT_NONE 0x00
|
||||
#define PROT_READ 0x01
|
||||
#define PROT_WRITE 0x02
|
||||
#define PROT_EXEC 0x04
|
||||
|
||||
#define MAP_FAILED ((void *)(-1))
|
||||
#define MAP_FILE 0x00
|
||||
#define MAP_PRIVATE 0x01
|
||||
#define MAP_SHARED 0x02
|
||||
#define MAP_FIXED 0x04
|
||||
#define MAP_ANON 0x08
|
||||
#define MAP_ANONYMOUS 0x08
|
||||
#define MAP_NORESERVE 0x10
|
||||
#define MAP_FIXED_NOREPLACE 0x20
|
||||
|
||||
#define MS_ASYNC 0x01
|
||||
#define MS_SYNC 0x02
|
||||
#define MS_INVALIDATE 0x04
|
||||
|
||||
#define MCL_CURRENT 0x01
|
||||
#define MCL_FUTURE 0x02
|
||||
|
||||
#define POSIX_MADV_NORMAL 1
|
||||
#define POSIX_MADV_SEQUENTIAL 2
|
||||
#define POSIX_MADV_RANDOM 3
|
||||
#define POSIX_MADV_DONTNEED 4
|
||||
#define POSIX_MADV_WILLNEED 5
|
||||
|
||||
#define MADV_NORMAL 0
|
||||
#define MADV_RANDOM 1
|
||||
#define MADV_SEQUENTIAL 2
|
||||
#define MADV_WILLNEED 3
|
||||
#define MADV_DONTNEED 4
|
||||
#define MADV_FREE 8
|
||||
|
||||
/* Linux extensions: */
|
||||
#define MREMAP_MAYMOVE 1
|
||||
#define MREMAP_FIXED 2
|
||||
|
||||
#define MFD_CLOEXEC 1U
|
||||
#define MFD_ALLOW_SEALING 2U
|
||||
|
||||
#endif /* _ABIBITS_MMAP_FLAGS_H */
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef _ABIBITS_WAIT_H
|
||||
#define _ABIBITS_WAIT_H
|
||||
|
||||
#if __MLIBC_BUILDING_MLIBC
|
||||
#warning wait.h is a broken header originally from the deprecated "mlibc" ABI. \
|
||||
We suggest to use abis/linux/wait.h instead. \
|
||||
Note that this will potentially require kernel changes.
|
||||
#endif
|
||||
|
||||
#define WCONTINUED 1
|
||||
#define WNOHANG 2
|
||||
#define WUNTRACED 4
|
||||
#define WEXITED 8
|
||||
#define WNOWAIT 16
|
||||
#define WSTOPPED 32
|
||||
|
||||
#define __WALL 0x40000000
|
||||
#define __WCLONE 0x80000000
|
||||
|
||||
#define WCOREFLAG 0x80
|
||||
|
||||
#define WEXITSTATUS(x) ((x) & 0x000000FF)
|
||||
#define WIFCONTINUED(x) ((x) & 0x00000100)
|
||||
#define WIFEXITED(x) ((x) & 0x00000200)
|
||||
#define WIFSIGNALED(x) ((x) & 0x00000400)
|
||||
#define WIFSTOPPED(x) ((x) & 0x00000800)
|
||||
#define WSTOPSIG(x) (((x) & 0x00FF0000) >> 16)
|
||||
#define WTERMSIG(x) (((x) & 0xFF000000) >> 24)
|
||||
#define WCOREDUMP(x) ((x) & WCOREFLAG)
|
||||
|
||||
#endif /*_ABIBITS_WAIT_H */
|
||||
Reference in New Issue
Block a user