Combine syscall code with final stack initialization code #32

Merged
td1223 merged 27 commits from read-only-exec into userprog-merge 2024-11-11 22:23:20 +00:00
4 changed files with 164 additions and 26 deletions
Showing only changes of commit 8912ef4660 - Show all commits

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;
} }
} }