Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysdeps/ironclad: fold mlibc abi into ironclad abi #946

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions abis/ironclad/access.h
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions abis/ironclad/blkcnt_t.h
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions abis/ironclad/blksize_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ABIBITS_BLKSIZE_T_H
#define _ABIBITS_BLKSIZE_T_H

// TODO: use int64_t?
typedef long blksize_t;

#endif // _ABIBITS_BLKSIZE_T_H

7 changes: 7 additions & 0 deletions abis/ironclad/clockid_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef _ABIBITS_CLOCKID_T_H
#define _ABIBITS_CLOCKID_T_H

typedef long clockid_t;

#endif /* _ABIBITS_CLOCKID_T_H */

6 changes: 6 additions & 0 deletions abis/ironclad/dev_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef _ABIBITS_DEV_T_H
#define _ABIBITS_DEV_T_H

typedef unsigned long dev_t;

#endif // _ABIBITS_DEV_T_H
6 changes: 6 additions & 0 deletions abis/ironclad/epoll.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef _ABIBITS_EPOLL_H
#define _ABIBITS_EPOLL_H

#define EPOLL_CLOEXEC 1

#endif // _ABIBITS_EPOLL_H
126 changes: 126 additions & 0 deletions abis/ironclad/errno.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#ifndef _ABIBITS_ERRNO_H
#define _ABIBITS_ERRNO_H

#define EDOM 1
#define EILSEQ 2
#define ERANGE 3

#define E2BIG 1001
#define EACCES 1002
#define EADDRINUSE 1003
#define EADDRNOTAVAIL 1004
#define EAFNOSUPPORT 1005
#define EAGAIN 1006
#define EALREADY 1007
#define EBADF 1008
#define EBADMSG 1009
#define EBUSY 1010
#define ECANCELED 1011
#define ECHILD 1012
#define ECONNABORTED 1013
#define ECONNREFUSED 1014
#define ECONNRESET 1015
#define EDEADLK 1016
#define EDESTADDRREQ 1017
#define EDQUOT 1018
#define EEXIST 1019
#define EFAULT 1020
#define EFBIG 1021
#define EHOSTUNREACH 1022
#define EIDRM 1023
#define EINPROGRESS 1024
#define EINTR 1025
#define EINVAL 1026
#define EIO 1027
#define EISCONN 1028
#define EISDIR 1029
#define ELOOP 1030
#define EMFILE 1031
#define EMLINK 1032
#define EMSGSIZE 1034
#define EMULTIHOP 1035
#define ENAMETOOLONG 1036
#define ENETDOWN 1037
#define ENETRESET 1038
#define ENETUNREACH 1039
#define ENFILE 1040
#define ENOBUFS 1041
#define ENODEV 1042
#define ENOENT 1043
#define ENOEXEC 1044
#define ENOLCK 1045
#define ENOLINK 1046
#define ENOMEM 1047
#define ENOMSG 1048
#define ENOPROTOOPT 1049
#define ENOSPC 1050
#define ENOSYS 1051
#define ENOTCONN 1052
#define ENOTDIR 1053
#define ENOTEMPTY 1054
#define ENOTRECOVERABLE 1055
#define ENOTSOCK 1056
#define ENOTSUP 1057
#define ENOTTY 1058
#define ENXIO 1059
#define EOPNOTSUPP 1060
#define EOVERFLOW 1061
#define EOWNERDEAD 1062
#define EPERM 1063
#define EPIPE 1064
#define EPROTO 1065
#define EPROTONOSUPPORT 1066
#define EPROTOTYPE 1067
#define EROFS 1068
#define ESPIPE 1069
#define ESRCH 1070
#define ESTALE 1071
#define ETIMEDOUT 1072
#define ETXTBSY 1073
#define EWOULDBLOCK EAGAIN
#define EXDEV 1075
#define ENODATA 1076
#define ETIME 1077
#define ENOKEY 1078
#define ESHUTDOWN 1079
#define EHOSTDOWN 1080
#define EBADFD 1081
#define ENOMEDIUM 1082
#define ENOTBLK 1083
#define ENONET 1084
#define EPFNOSUPPORT 1085
#define ESOCKTNOSUPPORT 1086
#define ESTRPIPE 1087
#define EREMOTEIO 1088
#define ERFKILL 1089
#define EBADR 1090
#define EUNATCH 1091
#define EMEDIUMTYPE 1092
#define EREMOTE 1093
#define EKEYREJECTED 1094
#define EUCLEAN 1095
#define EBADSLT 1096
#define ENOANO 1097
#define ENOCSI 1098
#define ENOSTR 1099
#define ETOOMANYREFS 1100
#define ENOPKG 1101
#define EKEYREVOKED 1102
#define EXFULL 1103
#define ELNRNG 1104
#define ENOTUNIQ 1105
#define ERESTART 1106
#define EUSERS 1107
#define ECHRNG 1108
#define ELIBBAD 1109
#define EL2HLT 1110
#define EL3HLT 1111
#define EKEYEXPIRED 1112
#define ECOMM 1113
#define EBADE 1114
#define EHWPOISON 1115
#define EBADRQC 1116

#define EIEIO 1524152434

#endif // _ABIBITS_ERRNO_H
97 changes: 56 additions & 41 deletions abis/ironclad/fcntl.h
Original file line number Diff line number Diff line change
@@ -1,50 +1,58 @@
#ifndef _ABIBITS_FCNTL_H
#define _ABIBITS_FCNTL_H

// reserve 3 bits for the access mode
#define O_ACCMODE 0x0007
#define O_RDONLY 1
#define O_WRONLY 2
#define O_RDWR 3
#define O_SEARCH 4
#define O_EXEC 7
// Flags supported by the kernel.
#define O_ACCMODE 0b000011
#define O_RDONLY 00000001
#define O_WRONLY 0b000010
#define O_RDWR 0b000011
#define O_APPEND 0b000100
#define O_CLOEXEC 0b001000
#define O_NOFOLLOW 0b010000
#define O_NONBLOCK 0b100000

// This flags are stubs.
#define O_APPEND 0x00008
#define O_CREAT 0x00010
#define O_DIRECTORY 0x00020
#define O_EXCL 0x00040
#define O_NOCTTY 0x00080
#define O_NOFOLLOW 0x00100
#define O_TRUNC 0x00200
#define O_NONBLOCK 0x00400
#define O_DSYNC 0x00800
#define O_RSYNC 0x01000
#define O_SYNC 0x02000
#define O_CLOEXEC 0x04000
#define O_PATH 0x08000
#define O_LARGEFILE 0x10000
#define O_NOATIME 0x20000
#define O_TMPFILE 0x40000
// Flags emulated by userland, we just have to make sure they dont overlap with
// kernel flags.
#define O_CREAT 0b0010000000
#define O_EXCL 0b0100000000
#define O_TRUNC 0b1000000000

// The constants below are copied from abis/mlibc/fcntl.h.
// Stubbed flags, the value really doesnt matter as long as they dont overlap
// with usable ones.
// Implemented here as some software needs them to compile.
#define O_SEARCH 0b000000000010000000000
#define O_EXEC 0b000000000100000000000
#define O_NOCTTY 0b000000001000000000000
#define O_DSYNC 0b000000010000000000000
#define O_RSYNC 0b000000100000000000000
#define O_SYNC 0b000001000000000000000
#define O_PATH 0b000010000000000000000
#define O_DIRECTORY 0b000100000000000000000
#define O_LARGEFILE 0b001000000000000000000
#define O_NOATIME 0b010000000000000000000
#define O_TMPFILE 0b100000000000000000000

// Fcntl flags.
#define FD_CLOEXEC 1
#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_SETLKW 9
#define F_GETOWN 10
#define F_SETOWN 11
#define F_GETFD 3
#define F_SETFD 4
#define F_GETFL 5
#define F_SETFL 6
#define F_GETPIPE_SZ 7
#define F_SETPIPE_SZ 8
#define F_GETLK 9
#define F_SETLK 10
#define F_SETLKW 11

#define F_RDLCK 1
#define F_UNLCK 2
#define F_WRLCK 3

#define FD_CLOEXEC 1
// Stubbed fcntl flags.
#define F_GETOWN 10
#define F_SETOWN 11

#define F_SEAL_SHRINK 0x0002
#define F_SEAL_GROW 0x0004
Expand All @@ -53,12 +61,19 @@
#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
// At flags.
#define AT_REMOVEDIR 500
#define AT_EACCESS 512
#define AT_FDCWD 0x7FFFFFFF
#define AT_EMPTY_PATH 1
#define AT_SYMLINK_FOLLOW 0
#define AT_SYMLINK_NOFOLLOW 2

#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 // _ABIBITS_FCNTL_H
8 changes: 8 additions & 0 deletions abis/ironclad/fsblkcnt_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ABIBITS_FSBLKCNT_T_H
#define _ABIBITS_FSBLKCNT_T_H

#include <bits/types.h>

typedef __mlibc_uint64 fsblkcnt_t;

#endif /* _ABIBITS_FSBLKCNT_T_H */
8 changes: 8 additions & 0 deletions abis/ironclad/fsfilcnt_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ABIBITS_FSFILCNT_T_H
#define _ABIBITS_FSFILCNT_T_H

#include <bits/types.h>

typedef __mlibc_uint64 fsfilcnt_t;

#endif /* _ABIBITS_FSFILCNT_T_H */
6 changes: 6 additions & 0 deletions abis/ironclad/gid_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef _ABIBITS_GID_T_H
#define _ABIBITS_GID_T_H

typedef unsigned int gid_t;

#endif // _ABIBITS_GID_T_H
Loading
Loading