Change tinyrt inclusion macros to always be defined

This commit is contained in:
flysand7 2023-07-25 16:09:15 +11:00
parent d49add907c
commit 8a93fa68ff
3 changed files with 9 additions and 10 deletions

View File

@ -115,10 +115,8 @@ for line in io.lines(tinyrt_manifest_path) do
local api_name = line_it():upper()
local has_impl = line_it()
if has_impl == '0' or has_impl == '1' then
if has_impl == '1' then
local api_define = '#define RT_API_' .. api_name .. '\n'
local api_define = '#define RT_API_' .. api_name .. ' '..has_impl..'\n'
tinyrt_iface_hdr:write(api_define)
end
else
print('SYNTAX ERROR AT LINE '..i..': Expected 1 or 0 for the value')
end

View File

@ -39,11 +39,12 @@ static RT_Status rt_file_read(u64 size, void *buffer, RT_File *from, u64 *out_by
}
static RT_Status rt_file_write(RT_File *to, u64 size, void *buffer, u64 *out_bytes_written) {
i64 bytes_written = syscall_write(to->fd, buffer, size);
if(bytes_written < 0) {
return RT_STATUS_FILE_IO_ERROR;
}
*out_bytes_written = bytes_written;
// Call the syscall
i64 status = syscall_write(to->fd, buffer, size);
if(-status == EBADF) return RT_ERROR_BAD_PARAM;
if(-status == EIO) return RT_STATUS_FILE_IO_ERROR;
if(-status > 0) return RT_STATUS_FILE_IO_ERROR;
*out_bytes_written = status;
return RT_STATUS_OK;
}

View File

@ -42,7 +42,7 @@ static RT_Status rt_init();
static RT_Status rt_deinit();
// File API
#if defined(RT_API_FILE)
#if RT_API_FILE == 1
struct RT_File typedef RT_File;
struct RT_File {
union {