misc file bugfixes

This commit is contained in:
Matheus
2022-09-24 14:55:47 -03:00
parent 177928d49a
commit 313abaeb9a
4 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ static int devfs_open(dirnode_t* parent, char* name){
}
static int devfs_close() UNIMPLEMENTED
static int devfs_close(){return 0;}
static int devfs_mkdir() UNIMPLEMENTED
static int devfs_create() UNIMPLEMENTED
static int devfs_write() UNIMPLEMENTED
+9 -1
View File
@@ -24,7 +24,7 @@ syscallret syscall_lseek(int ifd, off_t offset, int whence){
return retv;
}
int type = GETTYPE(fd->mode);
int type = GETTYPE(fd->node->st.st_mode);
if(type == TYPE_SOCKET || type == TYPE_FIFO){
retv.errno = ESPIPE;
@@ -33,6 +33,14 @@ syscallret syscall_lseek(int ifd, off_t offset, int whence){
off_t newoffset = fd->offset;
size_t fsize = fd->node->st.st_size;
if(type == TYPE_CHARDEV || type == TYPE_BLOCKDEV){
int err = devman_isseekable(fd->node->st.st_rdev, &fsize);
if(err){
retv.errno = err;
goto _ret;
}
}
switch(whence){
case SEEK_SET:
+1
View File
@@ -79,6 +79,7 @@ syscallret syscall_open(const char* pathname, int flags, mode_t mode){
fd->node = file;
fd->mode = file->st.st_mode;
fd_release(fd);
-3
View File
@@ -55,9 +55,6 @@ syscallret syscall_write(int ifd, void* buff, size_t count){
fd->offset += writec;
if(fd->node->st.st_size < fd->offset)
fd->offset = fd->node->st.st_size;
retv.errno = 0;
retv.ret = writec;