mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-31 14:38:21 +00:00
syscalls: fchmodat
This commit is contained in:
+7
-1
@@ -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
@@ -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
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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)){
|
||||
|
||||
Reference in New Issue
Block a user