10#ifndef LIBSYS_SYSTEM_CALLS_H
11#define LIBSYS_SYSTEM_CALLS_H
16#define kPrintDevicePath "/devices/tty{}"
17#define kCDDevicePath "/devices/dvd{}"
#define _Output
Definition CompilerHint.h:15
#define _Input
Definition CompilerHint.h:14
#define _InOut
Definition CompilerHint.h:22
IMPORT_C const Char * IoDimFile(_Input Ref dir_desc)
Gets the dir DIM.
IMPORT_C Char * StrFmt(const Char *fmt,...)
Definition SystemCalls.cc:14
IMPORT_C IORef PrintCreate(Void)
IMPORT_C const Char * IoMimeFile(_Input Ref file_desc)
Gets the file mime (if any).
IMPORT_C SInt32 SchedWriteMemory(_Input ProcessRef, SInt32, SInt32)
IMPORT_C IORef CdOpenTray(Void)
IMPORT_C Ref IoOpenFile(const Char *fs_path, const Char *drive_letter)
Opens a file from a drive.
IMPORT_C SInt32 MmSetHeapFlags(_Input VoidPtr heap, _Input UInt32 flags)
Change protection flags of a memory region.
IMPORT_C Void DrvUnmountDrive(_Input Char letter)
Unmount a drive.
IMPORT_C Bool RtlExitProcess(UIntPtr handle, UIntPtr exit_code)
Exits a process with an exit_code.
IMPORT_C BOOL FsMove(const Char *path, const Char *dst)
Ref MutexRef
Definition System.h:36
Ref SocketRef
Definition System.h:34
IMPORT_C SInt32 PwrReadCode(_Output SInt32 &code)
IMPORT_C SInt32 CdEjectDrive(_Input IORef cdrom)
SInt32 AffinityRef
Definition System.h:340
Ref NetworkRef
Definition System.h:35
IMPORT_C Ref LdrOpenDylibHandle(_Input const Char *path, _Input const Char *drive_letter)
Open Dylib handle.
IMPORT_C UInt64 StrMathToNumber(const Char *in, const Char **endp, const SInt16 base)
IMPORT_C BOOL IfsMount(const Char *path, const Char *drive_letter)
IMPORT_C Void IoCloseFile(_Input Ref file_desc)
Closes a file and flushes its content.
Definition SystemCalls.cc:129
IMPORT_C UInt64 IoRewindFile(_Input Ref file_desc)
Rewind the file pointer to the beginning of the file.
IMPORT_C SInt32 PwrSendCode(_Output SInt32 &code)
IMPORT_C BOOL FsCreateFile(const Char *path)
IMPORT_C SInt32 SchedGetAffinity(_Input ProcessRef, _InOut AffinityRef *)
IMPORT_C UInt32 MmFillCRC32Heap(_Input VoidPtr heap)
Fill memory region with CRC32.
IMPORT_C VoidPtr EvtDispatchEvent(_Input const Char *event_name, _Input VoidPtr event_data)
Dispatch an event.
IMPORT_C SInt32 ThrExitThread(_Input ThreadRef thread, _Input SInt32 exit_code)
Exit a thread.
IMPORT_C UInt32 IoWriteFile(_Input Ref file_desc, _Output VoidPtr out_data, UInt64 sz_data)
Write data to a file ref.
IMPORT_C SInt32 ThrJoinThread(ThreadRef thrd)
Joins a thread.
IMPORT_C BOOL IfsIsMounted(const Char *drive_letter)
IMPORT_C SInt32 ThrYieldThread(ThreadRef thrd)
Yields the current thread.
IMPORT_C SInt32 SchedReadMemory(_Input ProcessRef, SInt32, SInt32)
IMPORT_C SInt64 MmStrLen(const Char *str)
Get length of string.
Definition SystemCalls.cc:84
IMPORT_C ThreadRef ThrCreateThread(const Char *thread_name, ThrProcKind procedure, SInt32 argument_count, SInt32 flags)
Creates a thread.
IMPORT_C SInt32 SchedSetAffinity(_Input ProcessRef, SInt32 req, _Input AffinityRef *)
IMPORT_C UInt32 RtlSpawnIB(UIntPtr process_id)
Spawns a Thread Information Block and Global Information Block inside the current process.
IMPORT_C UIntPtr RtlSpawnProcess(const Char *process_path, UInt32 argc, Char **argv, Char **envp, UInt32 envp_len)
Spawns a process with a unique pid (stored as UIntPtr).
IMPORT_C UInt32 LdrCloseDylibHandle(_Input Ref *dll_handle)
Close Dylib handle.
REF_TYPE * Ref
Definition System.h:28
IMPORT_C SInt32 MmDestroyHeap(_Input VoidPtr heap)
Destroys the pointer.
IMPORT_C VoidPtr MmCreateHeap(_Input UInt64 len, _Input UInt32 flags)
Creates a new heap from the process's address space.
IMPORT_C SInt32 IoCtrlFile(_Input Ref file_desc, _Input UInt32 ioctl_code, _Input VoidPtr in_data, _Output VoidPtr out_data)
I/O control (ioctl) on a file.
SInt32(* ThrProcKind)(SInt32 argc, Char **argv)
Thread procedure function type.
Definition System.h:204
IMPORT_C SInt64 MmStrCmp(_Input const Char *dest, _Input const Char *src)
Compare string regions.
IMPORT_C SInt32 ThrExitMainThread(_Input SInt32 exit_code)
Exit the main thread.
IMPORT_C SInt64 MmCmpMemory(_Input VoidPtr dest, _Input VoidPtr src, _Input UInt64 len)
Compare memory regions.
UInt64 ProcessRef
Definition System.h:341
IMPORT_C BOOL IfsUnmount(const Char *drive_letter)
IMPORT_C Void EvtAddListener(_Input const Char *event_name, _Input Ref listener)
Add an event listener.
IMPORT_C Ref DrvGetMountedDrive(_Input Char letter)
Get a mounted drive from a letter.
IMPORT_C Void EvtRemoveListener(_Input const Char *event_name, _Input Ref listener)
Remove an event listener.
Ref FSRef
Definition System.h:31
Ref DylibRef
Definition System.h:32
IMPORT_C BOOL FsCopy(const Char *path, const Char *dst)
IMPORT_C SInt32 CdCloseTray(Void)
IMPORT_C Ref LdrGetDylibSymbolFromHandle(_Input const Char *symbol, _Input Ref dll_handle)
Dynamic Loader API.
IMPORT_C SInt32 PrintIn(IORef file, const Char *fmt,...)
Ref IORef
Definition System.h:30
IMPORT_C SInt32 ThrDetachThread(ThreadRef thrd)
Detach a thread.
IMPORT_C BOOL FsCreateAlias(const Char *path, const Char *from)
IMPORT_C UIntPtr SchedGetCurrentProcessID(Void)
IMPORT_C UInt32 MmGetHeapFlags(_Input VoidPtr heap)
Change protection flags of a memory region.
IMPORT_C Char * DrvGetDefaultDriveLetter(Void)
Get the default drive letter.
IMPORT_C UInt32 IoReadFile(_Input Ref file_desc, _Output VoidPtr *out_data, UInt64 sz_data)
Read data from a file.
IMPORT_C IORef PrintGet(const Char *path)
@ kPowerCodeShutdown
Definition System.h:301
@ kPowerCodeInvalid
Definition System.h:300
@ kPowerCodeWake
Definition System.h:304
@ kPowerCodeCount
Definition System.h:305
@ kPowerCodeReboot
Definition System.h:302
@ kPowerCodeSleep
Definition System.h:303
IMPORT_C SInt32 ThrExitCurrentThread(_Input SInt32 exit_code)
Exit the current thread.
IMPORT_C SInt32 SchedFireSignal(_Input ProcessRef, SInt32)
IMPORT_C VoidPtr MmCopyMemory(_Input VoidPtr dest, _Input VoidPtr src, _Input UInt64 len)
Copy memory region.
Definition SystemCalls.cc:21
IMPORT_C VoidPtr MmFillMemory(_Input VoidPtr dest, _Input UInt64 len, _Input UInt8 value)
Fill memory region.
Definition SystemCalls.cc:94
IMPORT_C SInt32 PrintOut(IORef file, const Char *fmt,...)
IMPORT_C Char * DrvGetDriveLetterFromPath(_Input const Char *path)
Get the drive letter from a path.
Ref SemaphoreRef
Definition System.h:38
IMPORT_C BOOL FsCreateDir(const Char *path)
IMPORT_C UInt64 IoTellFile(_Input Ref file_desc)
Tell the current position of the file pointer.
Definition SystemCalls.cc:145
IMPORT_C BOOL FsExists(const Char *path)
IMPORT_C UInt64 IoSeekFile(_Input Ref file_desc, UInt64 file_offset)
Seek file offset from file descriptor.
Ref ThreadRef
Definition System.h:33
IMPORT_C Void DrvMountDrive(_Input const Char *path, _Input const Char *letter)
Mount a drive.
IMPORT_C SInt32 PrintRelease(IORef)
Ref EventRef
Definition System.h:37
IMPORT_C SInt32 ErrGetLastError(Void)
void * VoidPtr
Definition Macros.h:59
__INT64_TYPE__ SInt64
Definition Macros.h:54
__INT16_TYPE__ SInt16
Definition Macros.h:56
#define IMPORT_C
Definition Macros.h:22
__INT32_TYPE__ SInt32
Definition Macros.h:55
Types API.
Definition System.h:23
UInt64 __hash
Definition System.h:24
VoidPtr __self
Hash of the syscall.
Definition System.h:25