Luna/libs/libc/include/luna/syscall.h

70 lines
2.7 KiB
C
Raw Normal View History

#ifndef _LUNA_SYSCALL_H
#define _LUNA_SYSCALL_H
#include <bits/error.h>
typedef unsigned long sysarg_t;
#ifdef __cplusplus
extern "C"
{
#endif
long __luna_syscall0(long sys_num);
long __luna_syscall1(long sys_num, sysarg_t arg0);
long __luna_syscall2(long sys_num, sysarg_t arg0, sysarg_t arg1);
long __luna_syscall3(long sys_num, sysarg_t arg0, sysarg_t arg1, sysarg_t arg2);
long __luna_syscall4(long sys_num, sysarg_t arg0, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3);
long __luna_syscall5(long sys_num, sysarg_t arg0, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4);
inline long __fast_syscall0(long number)
{
long result = __luna_syscall0(number);
_RETURN_WITH_ERRNO(result, long);
}
inline long __fast_syscall1(long number, sysarg_t arg0)
{
long result = __luna_syscall1(number, arg0);
_RETURN_WITH_ERRNO(result, long);
}
inline long __fast_syscall2(long number, sysarg_t arg0, sysarg_t arg1)
{
long result = __luna_syscall2(number, arg0, arg1);
_RETURN_WITH_ERRNO(result, long);
}
inline long __fast_syscall3(long number, sysarg_t arg0, sysarg_t arg1, sysarg_t arg2)
{
long result = __luna_syscall3(number, arg0, arg1, arg2);
_RETURN_WITH_ERRNO(result, long);
}
inline long __fast_syscall4(long number, sysarg_t arg0, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
{
long result = __luna_syscall4(number, arg0, arg1, arg2, arg3);
_RETURN_WITH_ERRNO(result, long);
}
inline long __fast_syscall5(long number, sysarg_t arg0, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
{
long result = __luna_syscall5(number, arg0, arg1, arg2, arg3, arg4);
_RETURN_WITH_ERRNO(result, long);
}
#define __lc_fast_syscall0(number) __fast_syscall0(number)
#define __lc_fast_syscall1(number, arg0) __fast_syscall1(number, (sysarg_t)arg0)
#define __lc_fast_syscall2(number, arg0, arg1) __fast_syscall2(number, (sysarg_t)arg0, (sysarg_t)arg1)
#define __lc_fast_syscall3(number, arg0, arg1, arg2) \
__fast_syscall3(number, (sysarg_t)arg0, (sysarg_t)arg1, (sysarg_t)arg2)
#define __lc_fast_syscall4(number, arg0, arg1, arg2, arg3) \
__fast_syscall4(number, (sysarg_t)arg0, (sysarg_t)arg1, (sysarg_t)arg2, (sysarg_t)arg3)
#define __lc_fast_syscall5(number, arg0, arg1, arg2, arg3, arg4) \
__fast_syscall5(number, (sysarg_t)arg0, (sysarg_t)arg1, (sysarg_t)arg2, (sysarg_t)arg3, (sysarg_t)arg4)
#ifdef __cplusplus
}
#endif
#endif