Create libioutil, implement a filewriter
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m21s

This commit is contained in:
2026-03-02 22:47:10 +01:00
parent 27afd57427
commit 58c515e90a
28 changed files with 231 additions and 29 deletions

View File

@@ -21,6 +21,7 @@
#include <sys/proc.h>
#include <syscall/syscall.h>
#include <syscall_defs.h>
#include <write_file.h>
#define DEFINE_SYSCALL(name) \
uintptr_t name (struct proc* UNUSED proc, void* UNUSED regs, struct reschedule_ctx* UNUSED rctx, \
@@ -503,12 +504,13 @@ DEFINE_SYSCALL (sys_create_file) {
return SYSRESULT (ret);
}
/* int write_file (char* path, size_t off, uint8_t* buffer, size_t size) */
/* int write_file (char* path, size_t off, uint8_t* buffer, size_t size, uint32_t flags) */
DEFINE_SYSCALL (sys_write_file) {
uintptr_t uvaddr_path = a1;
size_t off = (size_t)a2;
uintptr_t uvaddr_buffer = a3;
size_t size = (size_t)a4;
uint32_t flags = (uint32_t)a5;
struct limine_hhdm_response* hhdm = limine_hhdm_request.response;
@@ -529,7 +531,7 @@ DEFINE_SYSCALL (sys_write_file) {
return SYSRESULT (-ST_BAD_ADDRESS_SPACE);
spin_lock (&proc->lock);
int ret = vfs_write_file (proc, proc->cwv, path, buffer, off, size);
int ret = vfs_write_file (proc, proc->cwv, path, buffer, off, size, flags);
spin_unlock (&proc->lock);
return SYSRESULT (ret);