Implement writing to file system files in the write system call, w/ E

This commit is contained in:
sBubshait
2024-11-08 16:26:40 +00:00
parent 18694d7b62
commit 8912ef4660

View File

@@ -258,7 +258,15 @@ syscall_write (int fd, const void *buffer, unsigned size)
else else
{ {
/* Writing to a file. */ /* Writing to a file. */
return 0; // TODO: Implement Write to Files struct open_file *file_info = fd_get_file (fd);
if (file_info == NULL)
return 0;
lock_acquire (&filesys_lock);
int bytes = file_write (file_info->file, buffer, size);
lock_release (&filesys_lock);
return bytes;
} }
} }