libc: Move SYS_* constants to sys/syscall.h

This commit is contained in:
apio 2022-10-19 17:49:55 +02:00
parent b035795eb3
commit 5816f54293
3 changed files with 29 additions and 34 deletions

View File

@ -1,43 +1,21 @@
#ifndef _LUNA_SYSCALL_H #ifndef _LUNA_SYSCALL_H
#define _LUNA_SYSCALL_H #define _LUNA_SYSCALL_H
#define SYS_exit 0
#define SYS_yield 1
#define SYS_sleep 2
#define SYS_write 3
#define SYS_paint 4
#define SYS_getprocid 5
#define SYS_mmap 6
#define SYS_munmap 7
#define SYS_open 8
#define SYS_read 9
#define SYS_close 10
#define SYS_seek 11
#define SYS_exec 12
#define SYS_fcntl 13
#define SYS_mprotect 14
#define SYS_clock 15
#define SYS_mkdir 16
#define SYS_fork 17
#define SYS_waitpid 18
#ifndef __want_syscalls
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
#endif #endif
long int __luna_syscall0(long int sys_num); long __luna_syscall0(long sys_num);
long int __luna_syscall1(long int sys_num, unsigned long int arg0); long __luna_syscall1(long sys_num, unsigned long arg0);
long int __luna_syscall2(long int sys_num, unsigned long int arg0, unsigned long int arg1); long __luna_syscall2(long sys_num, unsigned long arg0, unsigned long arg1);
long int __luna_syscall3(long int sys_num, unsigned long int arg0, unsigned long int arg1, unsigned long int arg2); long __luna_syscall3(long sys_num, unsigned long arg0, unsigned long arg1, unsigned long arg2);
long int __luna_syscall4(long int sys_num, unsigned long int arg0, unsigned long int arg1, unsigned long int arg2, long __luna_syscall4(long sys_num, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3);
unsigned long int arg3); long __luna_syscall5(long sys_num, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3,
long int __luna_syscall5(long int sys_num, unsigned long int arg0, unsigned long int arg1, unsigned long int arg2, unsigned long arg4);
unsigned long int arg3, unsigned long int arg4);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif
#endif #endif

View File

@ -1,9 +1,24 @@
#ifndef _SYS_SYSCALL_H #ifndef _SYS_SYSCALL_H
#define _SYS_SYSCALL_H #define _SYS_SYSCALL_H
#define __want_syscalls #define SYS_exit 0
#include <luna/syscall.h> #define SYS_yield 1
#undef __want_syscalls #define SYS_sleep 2
#undef _LUNA_SYSCALL_H #define SYS_write 3
#define SYS_paint 4
#define SYS_getprocid 5
#define SYS_mmap 6
#define SYS_munmap 7
#define SYS_open 8
#define SYS_read 9
#define SYS_close 10
#define SYS_seek 11
#define SYS_exec 12
#define SYS_fcntl 13
#define SYS_mprotect 14
#define SYS_clock 15
#define SYS_mkdir 16
#define SYS_fork 17
#define SYS_waitpid 18
#endif #endif

View File

@ -3,6 +3,7 @@
#include <luna.h> #include <luna.h>
#include <luna/syscall.h> #include <luna/syscall.h>
#include <stdarg.h> #include <stdarg.h>
#include <sys/syscall.h>
#include <unistd.h> #include <unistd.h>
extern "C" extern "C"
@ -11,6 +12,7 @@ extern "C"
{ {
return (int)syscall(SYS_exec, program); return (int)syscall(SYS_exec, program);
} }
int execve(const char*, char* const[], char* const[]) int execve(const char*, char* const[], char* const[])
{ {
NOT_IMPLEMENTED("execve"); NOT_IMPLEMENTED("execve");