lseek on console

I’m failing lseek test

Opening fileonlytest.dat                                                                      │syscall (tf=tf@entry=0x8003bf70) at ../../arch/mips/syscall/syscall.c:133
Writing 16384 bytes.                                                                          │133                             break;
(program name unknown): (even) lseek failed: 18446744073709551615 != 1024: Illegal seek 

It is attemping to seek on the console and it fails as the man page says it should. Should the user be able to seek on the console?

Is this why I’m failing?

Consoles don’t have the seek functionality, check out vnode.h there is a little something in there that will help you determine whether a device is seekable…

Why is the test attempting to seek on the console then?

Because it is testing that you return the correct error code when a user tries to seek on a device that doesn’t support seeking.

1 Like

If you’re running fileonlytest it should NOT be lseeking on the console.

However, either way your lseek should handle proper error handling for unseekable vnodes which includes the console. It will be tested for in badcalls.

What it is checking is your return value. You are returning that really big number which is not what it expects. Make sure your return values are correct and since this is lseek make sure you handle the fact that the return value is 64 bits.

too late

I literally just wasted all of you’s’s times’s. I have a small error here that I just realized :confused:

FD #3 is perfectly valid. derp.

[press F for respects]

1 Like

Nice. You will run into issues with that check later however.

Think about what dup2 does. There is a better way to determine seekable files which was hinted at earlier in the posts.