Luna/libs/libc/include/luna/syscall.h
apio da2ede3450 Kernel, libc, userspace: Implement file descriptors
Kernel: Implement a descriptor struct which stores the opened node and read offset, and give each task 8 of those.
Implement three syscalls: sys_read, sys_open and sys_close (sys_write still writes to the console instead of using a fd, for now)
Implement three new errors: ENOENT, EBADF and EMFILE.

libc: Implement the new errors, and the new syscalls in syscall().
Also fix _RETURN_WITH_ERRNO() to set errno correctly, which was making strerror() return null, thus crashing perror().

userspace: make init demonstrate the new file API.
2022-10-10 20:21:39 +02:00

37 lines
1.1 KiB
C

#ifndef _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_rand 5
#define SYS_getversion 6
#define SYS_gettid 7
#define SYS_mmap 8
#define SYS_munmap 9
#define SYS_open 10
#define SYS_read 11
#define SYS_close 12
#ifndef __want_syscalls
#ifdef __cplusplus
extern "C"
{
#endif
long int __luna_syscall0(long int sys_num);
long int __luna_syscall1(long int sys_num, unsigned long int arg0);
long int __luna_syscall2(long int sys_num, unsigned long int arg0, unsigned long int arg1);
long int __luna_syscall3(long int sys_num, unsigned long int arg0, unsigned long int arg1, unsigned long int arg2);
long int __luna_syscall4(long int sys_num, unsigned long int arg0, unsigned long int arg1, unsigned long int arg2,
unsigned long int arg3);
long int __luna_syscall5(long int sys_num, unsigned long int arg0, unsigned long int arg1, unsigned long int arg2,
unsigned long int arg3, unsigned long int arg4);
#ifdef __cplusplus
}
#endif
#endif
#endif