Skip to content
  • Jonas Termansen's avatar
    Fix SEEK_END, file offset overflow, and read/write/mkpartition syscall bugs. · 568c97c7
    Jonas Termansen authored
    Fix SEEK_END seeking twice as far as requested. Centralize lseek handling in
    one place and avoid overflow bugs. Inode lseek handlers now only need to
    handle SEEK_END with offset 0. Prevent the file offset from ever going below
    zero or overflowing.
    
    Character devices are now not seekable, but lseek will pretend they are, yet
    always stay at the file offset 0. pread/pwrite on character devices will now
    ignore the file offset and call read/write.
    
    This change prevents character devices from being memory mapped, notably
    /dev/zero can no longer be memory mapped. None of the current ports seem
    to rely on this behavior and will work with just MAP_ANONYMOUS.
    
    Refactor read and write system calls to have a shared return statement for
    both seekable and non-seekable IO.
    
    Fix file offset overflow bugs in read and write system calls.
    
    Fix system calls returning EPERM instead of properly returning EBADF when
    the file has not been opened in the ...
    568c97c7