pub fn sys_lseek(&self, fd: FileDesc, offset: i64, whence: u8) -> SysResult {
        const SEEK_SET: u8 = 0;
        const SEEK_CUR: u8 = 1;
        const SEEK_END: u8 = 2;

        let pos = match whence {
            SEEK_SET => SeekFrom::Start(offset as u64),
            SEEK_END => SeekFrom::End(offset),
            SEEK_CUR => SeekFrom::Current(offset),
            _ => return Err(LxError::EINVAL),
        };
        info!("lseek: fd={:?}, pos={:?}", fd, pos);

        let proc = self.linux_process();
        let file = proc.get_file(fd)?;
        let offset = file.seek(pos)?;
        Ok(offset as usize)
    }
/// repositions the offset of the open file associated with the file descriptor fd
/// to the argument offset according to the directive whence
repositions the offset of the open file associated with the file descriptor fd
to the argument offset according to the directive whence
repositions the offset of the open file associated with the file descriptor fd to the argument offset according to the directive whence
pub fn sys_lseek(&self, fd: FileDesc, offset: i64, whence: u8) -> SysResult {
        const SEEK_SET: u8 = 0;
        const SEEK_CUR: u8 = 1;
        const SEEK_END: u8 = 2;
        let pos = match whence {
            SEEK_SET => SeekFrom::Start(offset as u64),
            SEEK_END => SeekFrom::End(offset),
            SEEK_CUR => SeekFrom::Current(offset),
            _ => return Err(LxError::EINVAL),
        };
        info!("lseek: fd={:?}, pos={:?}", fd, pos);
        let proc = self.linux_process();
        let file = proc.get_file(fd)?;
        let offset = file.seek(pos)?;
        Ok(offset as usize)
    }
pub fn sys_lseek ( & self , fd : FileDesc , offset : i64 , whence : u8 ) -> SysResult { const SEEK_SET : u8 = 0 ; const SEEK_CUR : u8 = 1 ; const SEEK_END : u8 = 2 ; let pos = match whence { SEEK_SET => SeekFrom :: Start ( offset as u64 ) , SEEK_END => SeekFrom :: End ( offset ) , SEEK_CUR => SeekFrom :: Current ( offset ) , _ => return Err ( LxError :: EINVAL ) , } ; info ! ( " " fd pos ) ; let proc = self . linux_process ( ) ; let file = proc . get_file ( fd ) ? ; let offset = file . seek ( pos ) ? ; Ok ( offset as usize ) }
repositions the offset of the open file associated with the file descriptor fd
to the argument offset according to the directive whence
repositions the offset of the open file associated with the file descriptor fd to the argument offset according to the directive whence
&self
fd
FileDesc
offset
i64
whence
u8
&self
fd
FileDesc
offset
i64
whence
u8