From owner-freebsd-hackers Thu Dec 21 17:18:21 2000 From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 21 17:18:19 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from whizkidtech.net (r9.bfm.org [216.127.220.105]) by hub.freebsd.org (Postfix) with ESMTP id DB1F637B400 for ; Thu, 21 Dec 2000 17:18:13 -0800 (PST) Received: (from adam@localhost) by whizkidtech.net (8.9.2/8.9.2) id TAA00306 for hackers@FreeBSD.org; Thu, 21 Dec 2000 19:17:10 -0600 (CST) (envelope-from adam) Date: Thu, 21 Dec 2000 19:16:38 -0600 From: "G. Adam Stanislav" To: hackers@FreeBSD.org Subject: Trouble with lseek Message-ID: <20001221191638.A284@whizkidtech.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 1.0.1i Organization: Whiz Kid Technomagic X-URL: http://www.whizkidtech.net/ X-Castle: http://www.redprince.net/ X-Special-Effects: http://www.FilmSFX.com/ X-Operating-System: FreeBSD whizkidtech.net 3.1-RELEASE FreeBSD 3.1-RELEASE Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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