mirror of https://github.com/flysand7/ciabatta.git
Add program api to tinyrt
This commit is contained in:
parent
8a93fa68ff
commit
1007f634fb
|
@ -3,6 +3,7 @@
|
|||
|
||||
// Pre-C23 keyword macros and stddef
|
||||
#define static_assert _Static_assert
|
||||
#define noreturn _Noreturn
|
||||
#define NULL ((void *)0)
|
||||
|
||||
// Platform macros
|
||||
|
|
|
@ -167,8 +167,9 @@ static inline i64 syscall_close(u32 fd) {
|
|||
return __syscall1(SYS_close, fd);
|
||||
}
|
||||
|
||||
static inline i64 syscall_exit(int code) {
|
||||
return __syscall1(SYS_exit, (i64)code);
|
||||
static inline noreturn void syscall_exit(int code) {
|
||||
__syscall1(SYS_exit, (i64)code);
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
static inline i64 syscall_arch_prctl_set(int code, u64 value) {
|
||||
|
|
|
@ -55,3 +55,7 @@ static RT_Status rt_file_close(RT_File *file) {
|
|||
}
|
||||
return RT_STATUS_OK;
|
||||
}
|
||||
|
||||
static noreturn void rt_program_exit(int code) {
|
||||
syscall_exit(code);
|
||||
}
|
||||
|
|
|
@ -11,3 +11,5 @@
|
|||
# #define RT_API_FILE
|
||||
|
||||
file = 1
|
||||
program = 1
|
||||
shell = 0
|
||||
|
|
10
src/tinyrt.h
10
src/tinyrt.h
|
@ -41,6 +41,16 @@ static bool _rt_api_tmpfile;
|
|||
static RT_Status rt_init();
|
||||
static RT_Status rt_deinit();
|
||||
|
||||
// Program API
|
||||
#if RT_API_PROGRAM == 1
|
||||
static noreturn void rt_program_exit(int code);
|
||||
#endif
|
||||
|
||||
#if RT_API_ENVIRONMENT == 1
|
||||
static RT_Status rt_shell_exec(char const *cmd);
|
||||
static RT_Status rt_env_get(char const *name);
|
||||
#endif
|
||||
|
||||
// File API
|
||||
#if RT_API_FILE == 1
|
||||
struct RT_File typedef RT_File;
|
||||
|
|
Loading…
Reference in New Issue