type seek_command = SEEK_SET | SEEK_CUR | SEEK_END (* déplace le descripteur à une position donnée dans le flot *) let lseek desc offset seek_command = if desc.inode.stats.st_size > max_file_size then system_error EIO "lseek" "Inconsistent file size"; let new_pos = offset + match seek_command with | SEEK_SET -> 0 | SEEK_CUR -> desc.pos | SEEK_END -> desc.inode.stats.st_size in if new_pos < 0 then system_error EINVAL "lseek" "position out of bounds" else begin desc.pos <- new_pos; new_pos end;; |