syscalls: fchmod

This commit is contained in:
Matheus
2022-10-20 23:23:55 -03:00
parent e1cd9aba0e
commit 3cd7baa390
2 changed files with 34 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
#include <kernel/syscalls.h>
#include <kernel/vfs.h>
#include <sys/types.h>
#include <arch/cls.h>
#include <kernel/fd.h>
#include <kernel/sched.h>
syscallret syscall_fchmod(int ifd, mode_t mode){
syscallret retv;
retv.ret = -1;
proc_t* proc = arch_getcls()->thread->proc;
fd_t* fd;
int err = fd_access(&proc->fdtable, &fd, ifd);
if(err){
retv.errno = err;
return retv;
}
retv.errno = vfs_chmod(fd->node, mode);
fd_release(fd);
retv.ret = retv.errno ? -1 : 0;
return retv;
}