mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
System calls in libmaxsi now use the constants from syscallnum.h.
This commit is contained in:
parent
8be3624ca3
commit
fecaf6b43f
10 changed files with 31 additions and 29 deletions
|
@ -36,7 +36,7 @@ namespace Maxsi
|
|||
extern "C" { int errno = 0; }
|
||||
|
||||
#ifndef SORTIX_KERNEL
|
||||
DEFN_SYSCALL1(int, SysRegisterErrno, 28, int*);
|
||||
DEFN_SYSCALL1(int, SysRegisterErrno, SYSCALL_REGISTER_ERRNO, int*);
|
||||
|
||||
extern "C" void init_error_functions()
|
||||
{
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#ifndef LIBMAXSI_SYSCALL_H
|
||||
#define LIBMAXSI_SYSCALL_H
|
||||
|
||||
#include <sortix/syscallnum.h>
|
||||
|
||||
namespace Maxsi
|
||||
{
|
||||
#define DECL_SYSCALL0(type,fn) type fn();
|
||||
|
|
|
@ -36,18 +36,18 @@
|
|||
|
||||
namespace Maxsi
|
||||
{
|
||||
DEFN_SYSCALL1(size_t, SysPrint, 4, const char*);
|
||||
DEFN_SYSCALL3(ssize_t, SysRead, 18, int, void*, size_t);
|
||||
DEFN_SYSCALL3(ssize_t, SysWrite, 19, int, const void*, size_t);
|
||||
DEFN_SYSCALL1(int, SysPipe, 20, int*);
|
||||
DEFN_SYSCALL1(int, SysClose, 21, int);
|
||||
DEFN_SYSCALL1(int, SysDup, 22, int);
|
||||
DEFN_SYSCALL3(int, SysOpen, 23, const char*, int, mode_t);
|
||||
DEFN_SYSCALL3(int, SysReadDirEnts, 24, int, struct sortix_dirent*, size_t);
|
||||
DEFN_SYSCALL1(int, SysChDir, 25, const char*);
|
||||
DEFN_SYSCALL2(char*, SysGetCWD, 26, char*, size_t);
|
||||
DEFN_SYSCALL1(int, SysUnlink, 27, const char*);
|
||||
DEFN_SYSCALL1(int, SysIsATTY, 33, int);
|
||||
DEFN_SYSCALL1(size_t, SysPrint, SYSCALL_PRINT_STRING, const char*);
|
||||
DEFN_SYSCALL3(ssize_t, SysRead, SYSCALL_READ, int, void*, size_t);
|
||||
DEFN_SYSCALL3(ssize_t, SysWrite, SYSCALL_WRITE, int, const void*, size_t);
|
||||
DEFN_SYSCALL1(int, SysPipe, SYSCALL_PIPE, int*);
|
||||
DEFN_SYSCALL1(int, SysClose, SYSCALL_CLOSE, int);
|
||||
DEFN_SYSCALL1(int, SysDup, SYSCALL_DUP, int);
|
||||
DEFN_SYSCALL3(int, SysOpen, SYSCALL_OPEN, const char*, int, mode_t);
|
||||
DEFN_SYSCALL3(int, SysReadDirEnts, SYSCALL_READDIRENTS, int, struct sortix_dirent*, size_t);
|
||||
DEFN_SYSCALL1(int, SysChDir, SYSCALL_CHDIR, const char*);
|
||||
DEFN_SYSCALL2(char*, SysGetCWD, SYSCALL_GETCWD, char*, size_t);
|
||||
DEFN_SYSCALL1(int, SysUnlink, SYSCALL_UNLINK, const char*);
|
||||
DEFN_SYSCALL1(int, SysIsATTY, SYSCALL_ISATTY, int);
|
||||
|
||||
size_t Print(const char* string)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Maxsi
|
|||
namespace Memory
|
||||
{
|
||||
#ifndef SORTIX_KERNEL
|
||||
DEFN_SYSCALL2(int, SysMemStat, 32, size_t*, size_t*);
|
||||
DEFN_SYSCALL2(int, SysMemStat, SYSCALL_MEMSTAT, size_t*, size_t*);
|
||||
|
||||
extern "C" int memstat(size_t* memused, size_t* memtotal)
|
||||
{
|
||||
|
|
|
@ -30,12 +30,12 @@ namespace Maxsi
|
|||
{
|
||||
namespace Process
|
||||
{
|
||||
DEFN_SYSCALL1_VOID(SysExit, 1, int);
|
||||
DEFN_SYSCALL4(int, SysExecVE, 10, const char*, int, char* const*, char* const*);
|
||||
DEFN_SYSCALL0(pid_t, SysFork, 12);
|
||||
DEFN_SYSCALL0(pid_t, SysGetPID, 13);
|
||||
DEFN_SYSCALL0(pid_t, SysGetParentPID, 14);
|
||||
DEFN_SYSCALL3(pid_t, SysWait, 17, pid_t, int*, int);
|
||||
DEFN_SYSCALL1_VOID(SysExit, SYSCALL_EXIT, int);
|
||||
DEFN_SYSCALL4(int, SysExecVE, SYSCALL_EXEC, const char*, int, char* const*, char* const*);
|
||||
DEFN_SYSCALL0(pid_t, SysFork, SYSCALL_FORK);
|
||||
DEFN_SYSCALL0(pid_t, SysGetPID, SYSCALL_GETPID);
|
||||
DEFN_SYSCALL0(pid_t, SysGetParentPID, SYSCALL_GETPPID);
|
||||
DEFN_SYSCALL3(pid_t, SysWait, SYSCALL_WAIT, pid_t, int*, int);
|
||||
|
||||
int Execute(const char* filepath, int argc, const char** argv)
|
||||
{
|
||||
|
|
|
@ -93,9 +93,9 @@ namespace Maxsi
|
|||
}
|
||||
}
|
||||
|
||||
DEFN_SYSCALL1_VOID(SysRegisterSignalHandler, 29, sighandler_t);
|
||||
DEFN_SYSCALL0_VOID(SysSigReturn, 30);
|
||||
DEFN_SYSCALL2(int, SysKill, 31, pid_t, int);
|
||||
DEFN_SYSCALL1_VOID(SysRegisterSignalHandler, SYSCALL_REGISTER_SIGNAL_HANDLER, sighandler_t);
|
||||
DEFN_SYSCALL0_VOID(SysSigReturn, SYSCALL_SIGRETURN);
|
||||
DEFN_SYSCALL2(int, SysKill, SYSCALL_KILL, pid_t, int);
|
||||
|
||||
void Init()
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace System
|
|||
{
|
||||
namespace Keyboard
|
||||
{
|
||||
DEFN_SYSCALL1(uint32_t, SysReceiveKeystroke, 8, unsigned);
|
||||
DEFN_SYSCALL1(uint32_t, SysReceiveKeystroke, SYSCALL_RECEIVE_KEYSTROKE, unsigned);
|
||||
|
||||
uint32_t ReceiveKeystroke(unsigned method)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace System
|
|||
{
|
||||
namespace Sound
|
||||
{
|
||||
DEFN_SYSCALL1_VOID(SysSetFrequency, 9, unsigned);
|
||||
DEFN_SYSCALL1_VOID(SysSetFrequency, SYSCALL_SET_FREQUENCY, unsigned);
|
||||
|
||||
void SetFrequency(unsigned frequency)
|
||||
{
|
||||
|
|
|
@ -39,9 +39,9 @@ namespace Maxsi
|
|||
{
|
||||
typedef void (*SysEntry)(size_t, Entry, void*);
|
||||
DEFN_SYSCALL4(size_t, SysCreate, 0, SysEntry, Entry, const void*, size_t);
|
||||
DEFN_SYSCALL1_VOID(SysExit, 1, const void*);
|
||||
DEFN_SYSCALL1_VOID(SysSleep, 2, long);
|
||||
DEFN_SYSCALL1_VOID(SysUSleep, 3, long);
|
||||
DEFN_SYSCALL1_VOID(SysExit, SYSCALL_EXIT, const void*);
|
||||
DEFN_SYSCALL1_VOID(SysSleep, SYSCALL_SLEEP, long);
|
||||
DEFN_SYSCALL1_VOID(SysUSleep, SYSCALL_USLEEP, long);
|
||||
|
||||
void Exit(const void* Result)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Maxsi
|
|||
{
|
||||
namespace Time
|
||||
{
|
||||
DEFN_SYSCALL1(int, SysUptime, 34, uintmax_t*);
|
||||
DEFN_SYSCALL1(int, SysUptime, SYSCALL_UPTIME, uintmax_t*);
|
||||
|
||||
extern "C" int uptime(uintmax_t* usecssinceboot)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue