mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
misc file bugfixes
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user