syscalls: fchmodat

This commit is contained in:
Matheus
2022-10-16 13:14:00 -03:00
parent e7f72d3883
commit b94d37cade
8 changed files with 109 additions and 7 deletions
+7 -1
View File
@@ -77,8 +77,14 @@ static int devfs_getdirent(dirnode_t* node, dent_t* buff, size_t count, uintmax_
return 0;
}
static int devfs_chmod(vnode_t* node, mode_t mode){
node->st.st_mode &= ~07777;
node->st.st_mode |= mode & 07777;
return 0;
}
static fscalls_t devfscalls = {
devfs_mount, devfs_unmount, devfs_open, devfs_close, devfs_mkdir, devfs_create, devfs_write, devfs_read, devfs_getdirent
devfs_mount, devfs_unmount, devfs_open, devfs_close, devfs_mkdir, devfs_create, devfs_write, devfs_read, devfs_getdirent, devfs_chmod
};
void devfs_init(){
+7 -1
View File
@@ -155,8 +155,14 @@ static int tmpfs_getdirent(dirnode_t* node, dent_t* buff, size_t count, uintmax_
return 0;
}
static int tmpfs_chmod(vnode_t* node, mode_t mode){
node->st.st_mode &= ~07777;
node->st.st_mode |= mode & 07777;
return 0;
}
static fscalls_t funcs = {
tmpfs_mount, tmpfs_unmount, tmpfs_open, tmpfs_close, tmpfs_mkdir, tmpfs_create, tmpfs_write, tmpfs_read, tmpfs_getdirent
tmpfs_mount, tmpfs_unmount, tmpfs_open, tmpfs_close, tmpfs_mkdir, tmpfs_create, tmpfs_write, tmpfs_read, tmpfs_getdirent, tmpfs_chmod
};
+15
View File
@@ -100,6 +100,21 @@ int vfs_isatty(vnode_t* node){
}
int vfs_chmod(vnode_t* node, mode_t mode){
if(!node->fs->calls->chmod)
return ENOSYS;
spinlock_acquire(&lock);
int ret = node->fs->calls->chmod(node, mode);
spinlock_release(&lock);
return ret;
}
int vfs_poll(vnode_t* node, pollfd* fd){
switch(GETTYPE(node->st.st_mode)){