Skip to content
Open
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
1 change: 1 addition & 0 deletions libc/config/linux/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.sys.mman.munlockall
libc.src.sys.mman.munmap
libc.src.sys.mman.remap_file_pages
libc.src.sys.mman.process_mrelease
libc.src.sys.mman.posix_madvise
libc.src.sys.mman.shm_open
libc.src.sys.mman.shm_unlink
Expand Down
1 change: 1 addition & 0 deletions libc/config/linux/riscv/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.sys.mman.munmap
libc.src.sys.mman.remap_file_pages
libc.src.sys.mman.posix_madvise
libc.src.sys.mman.process_mrelease
libc.src.sys.mman.shm_open
libc.src.sys.mman.shm_unlink

Expand Down
1 change: 1 addition & 0 deletions libc/config/linux/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.sys.mman.munmap
libc.src.sys.mman.remap_file_pages
libc.src.sys.mman.posix_madvise
libc.src.sys.mman.process_mrelease
libc.src.sys.mman.shm_open
libc.src.sys.mman.shm_unlink

Expand Down
7 changes: 7 additions & 0 deletions libc/hdrgen/yaml/sys/mman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,10 @@ functions:
return_type: int
arguments:
- type: const char *
- name: process_mrelease
standards:
- Linux
return_type: int
arguments:
- type: int
- type: unsigned int
3 changes: 3 additions & 0 deletions libc/include/sys/syscall.h.def
Original file line number Diff line number Diff line change
Expand Up @@ -2349,5 +2349,8 @@
#define SYS_writev __NR_writev
#endif

#ifdef __NR_process_mrelease
#define SYS_process_mrelease __NR_process_mrelease
#endif

#endif // LLVM_LIBC_SYS_SYSCALL_H
334 changes: 334 additions & 0 deletions libc/spec/linux.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,334 @@
def StructEpollEvent : NamedType<"struct epoll_event">;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is now unnecessary.

def StructEpollEventPtr : PtrType<StructEpollEvent>;

def StructEpollData : NamedType<"struct epoll_data">;

def Linux : StandardSpec<"Linux"> {
HeaderSpec Errno = HeaderSpec<
"errno.h",
[
Macro<"ENOMEDIUM">,
Macro<"ENOTBLK">,
Macro<"EMEDIUMTYPE">,
Macro<"EBADSLT">,
Macro<"ECHRNG">,
Macro<"ERFKILL">,
Macro<"EUSERS">,
Macro<"EBADR">,
Macro<"EL3HLT">,
Macro<"ENOTUNIQ">,
Macro<"EXFULL">,
Macro<"EHOSTDOWN">,
Macro<"EL3RST">,
Macro<"ENOPKG">,
Macro<"ENOCSI">,
Macro<"EUNATCH">,
Macro<"EREMCHG">,
Macro<"ETOOMANYREFS">,
Macro<"EL2HLT">,
Macro<"EBADFD">,
Macro<"EREMOTEIO">,
Macro<"ENAVAIL">,
Macro<"ELIBEXEC">,
Macro<"ESHUTDOWN">,
Macro<"ENOKEY">,
Macro<"ESTRPIPE">,
Macro<"EKEYREJECTED">,
Macro<"ESRMNT">,
Macro<"EKEYREVOKED">,
Macro<"EBADE">,
Macro<"ELIBBAD">,
Macro<"EISNAM">,
Macro<"EBFONT">,
Macro<"EPFNOSUPPORT">,
Macro<"EREMOTE">,
Macro<"EDEADLOCK">,
Macro<"ENONET">,
Macro<"EDOTDOT">,
Macro<"EKEYEXPIRED">,
Macro<"ELIBSCN">,
Macro<"ERESTART">,
Macro<"EBADRQC">,
Macro<"EUCLEAN">,
Macro<"ENOANO">,
Macro<"ELIBACC">,
Macro<"EHWPOISON">,
Macro<"ELIBMAX">,
Macro<"ESOCKTNOSUPPORT">,
Macro<"ENOTNAM">,
Macro<"ELNRNG">,
Macro<"EL2NSYNC">,
Macro<"EADV">,
Macro<"ECOMM">,
]
>;

HeaderSpec Sched = HeaderSpec<
"sched.h",
[
Macro<"SCHED_OTHER">,
Macro<"SCHED_FIFO">,
Macro<"SCHED_RR">,
Macro<"SCHED_BATCH">,
Macro<"SCHED_ISO">,
Macro<"SCHED_IDLE">,
Macro<"SCHED_DEADLINE">,
],
[], // Types
[], // Enumerations
[] // Functions
>;

HeaderSpec SysMMan = HeaderSpec<
"sys/mman.h",
[Macro<"MAP_ANONYMOUS">],
[], // Types
[], // Enumerations
[
FunctionSpec<
"mincore",
RetValSpec<IntType>,
[
ArgSpec<VoidPtr>,
ArgSpec<SizeTType>,
ArgSpec<UnsignedCharPtr>,
]
>,
FunctionSpec<
"mlock2",
RetValSpec<IntType>,
[
ArgSpec<VoidPtr>,
ArgSpec<SizeTType>,
ArgSpec<UnsignedIntType>,
]
>,
FunctionSpec<
"remap_file_pages",
RetValSpec<IntType>,
[
ArgSpec<VoidPtr>,
ArgSpec<SizeTType>,
ArgSpec<IntType>,
ArgSpec<SizeTType>,
ArgSpec<IntType>,
FunctionSpec<
"process_mrelease",
RetValSpec<IntType>,
[
ArgSpec<IntType>,
ArgSpec<UnsignedIntType>
]
>,
FunctionSpec<
"mremap",
RetValSpec<VoidPtr>,
[
ArgSpec<VoidPtr>,
ArgSpec<SizeTType>,
ArgSpec<SizeTType>,
ArgSpec<IntType>,
ArgSpec<VarArgType>,
]
>,
] // Functions
>;


HeaderSpec SysPrctl = HeaderSpec<
"sys/prctl.h",
[], // Macros
[], // Types
[], // Enumerations
[
FunctionSpec<
"prctl",
RetValSpec<IntType>,
[
ArgSpec<IntType>,
ArgSpec<UnsignedLongType>,
ArgSpec<UnsignedLongType>,
ArgSpec<UnsignedLongType>,
ArgSpec<UnsignedLongType>,
]
>,
] // Functions
>;

HeaderSpec SysRandom = HeaderSpec<
"sys/random.h",
[
Macro<"GRND_RANDOM">,
Macro<"GRND_NONBLOCK">,
Macro<"GRND_INSECURE">,
],
[SizeTType, SSizeTType], // Types
[], // Enumerations
[
FunctionSpec<
"getrandom",
RetValSpec<SSizeTType>,
[
ArgSpec<VoidPtr>,
ArgSpec<SizeTType>,
ArgSpec<UnsignedIntType>
]
>,
]
>;

HeaderSpec SysTime = HeaderSpec<
"sys/time.h",
[
Macro<"timeradd">,
Macro<"timersub">,
Macro<"timerclear">,
Macro<"timerisset">,
Macro<"timercmp">,
],
[StructTimevalType], // Types
[], // Enumerations
[] // Functions
>;


HeaderSpec SysEpoll = HeaderSpec<
"sys/epoll.h",
[], // Macros
[
StructEpollEvent,
StructEpollData,
SigSetType,
StructTimeSpec,
], // Types
[], // Enumerations
[
FunctionSpec<
"epoll_create",
RetValSpec<IntType>,
[
ArgSpec<IntType>
]
>,
FunctionSpec<
"epoll_create1",
RetValSpec<IntType>,
[
ArgSpec<IntType>
]
>,
FunctionSpec<
"epoll_ctl",
RetValSpec<IntType>,
[
ArgSpec<IntType>,
ArgSpec<IntType>,
ArgSpec<IntType>,
ArgSpec<StructEpollEventPtr>
]
>,
FunctionSpec<
"epoll_wait",
RetValSpec<IntType>,
[
ArgSpec<IntType>,
ArgSpec<StructEpollEventPtr>,
ArgSpec<IntType>,
ArgSpec<IntType>
]
>,
FunctionSpec<
"epoll_pwait",
RetValSpec<IntType>,
[
ArgSpec<IntType>,
ArgSpec<StructEpollEventPtr>,
ArgSpec<IntType>,
ArgSpec<IntType>,
ArgSpec<ConstSigSetPtrType>
]
>,
FunctionSpec<
"epoll_pwait2",
RetValSpec<IntType>,
[
ArgSpec<IntType>,
ArgSpec<StructEpollEventPtr>,
ArgSpec<IntType>,
ArgSpec<ConstStructTimeSpecPtr>,
ArgSpec<ConstSigSetPtrType>
]
>,
] // Functions
>;

HeaderSpec Signal = HeaderSpec<
"signal.h",
[
Macro<"NSIG">,

Macro<"SIGHUP">,
Macro<"SIGINT">,
Macro<"SIGQUIT">,
Macro<"SIGILL">,
Macro<"SIGTRAP">,
Macro<"SIGABRT">,
Macro<"SIGIOT">,
Macro<"SIGBUS">,
Macro<"SIGFPE">,
Macro<"SIGKILL">,
Macro<"SIGUSR1">,
Macro<"SIGSEGV">,
Macro<"SIGUSR2">,
Macro<"SIGPIPE">,
Macro<"SIGALRM">,
Macro<"SIGTERM">,
Macro<"SIGSTKFLT">,
Macro<"SIGCHLD">,
Macro<"SIGCONT">,
Macro<"SIGSTOP">,
Macro<"SIGTSTP">,
Macro<"SIGTTIN">,
Macro<"SIGTTOU">,
Macro<"SIGURG">,
Macro<"SIGXCPU">,
Macro<"SIGXFSZ">,
Macro<"SIGVTALRM">,
Macro<"SIGPROF">,
Macro<"SIGWINCH">,
Macro<"SIGIO">,
Macro<"SIGPOLL">,
Macro<"SIGPWR">,
Macro<"SIGSYS">,
Macro<"SIGUNUSED">,
]
>;


HeaderSpec UniStd = HeaderSpec<
"unistd.h",
[], // Macros
[],
[], // Enumerations
[
FunctionSpec<
"pipe2",
RetValSpec<IntType>,
[ArgSpec<IntPtr>, ArgSpec<IntType>] //TODO: make this int[2]
>,
],
[]
>;


let Headers = [
Errno,
SysEpoll,
SysMMan,
SysPrctl,
SysRandom,
SysTime,
Signal,
UniStd,
];
}
6 changes: 6 additions & 0 deletions libc/src/sys/mman/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,9 @@ add_entrypoint_object(
DEPENDS
.${LIBC_TARGET_OS}.mremap
)

add_entrypoint_object(
process_mrelease
ALIAS
DEPENDS
.${LIBC_TARGET_OS}.process_mrelease)
Loading
Loading