Date: Thu, 21 Dec 2000 19:16:38 -0600 From: "G. Adam Stanislav" <adam@whizkidtech.net> To: hackers@FreeBSD.org Subject: Trouble with lseek Message-ID: <20001221191638.A284@whizkidtech.net>
next in thread | raw e-mail | index | archive | help
I am trying to determine the size of a file passed as a command line argument. I am using SYS_lseek. Here is the code up to that point: _start: pop eax ; argc pop eax ; program name pop ecx ; file to convert jecxz usage pop eax or eax, eax ; Too many arguments? jne usage ; Open the file push dword O_RDWR push ecx sys.open jc cantopen mov ebp, eax ; Save fd ; Find file size sub eax, eax push dword SEEK_END push eax push eax ; 0 bytes from eof push ebp ; fd sys.lseek jc facerr Unfortunately, the SYS_lseek returns an error (carry is set, EAX=0x16=ESPIPE). Why? I am not creating any pipes there. The fd returned by the SYS_open is 3, as expected, so why does SYS_lseek fail? The sys.lseek macro does a mov eax, 199 / call kernel.function, where kernel.function is int 80h / ret. Adam -- Can you imagine the silence if everyone said only what he knows! -- Karel Čapek To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001221191638.A284>