From owner-freebsd-hackers Thu Jan 18 01:33:09 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id BAA15441 for hackers-outgoing; Thu, 18 Jan 1996 01:33:09 -0800 (PST) Received: from bsdi.BSDI.COM (bsdi.BSDI.COM [205.230.224.1]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id BAA15428 for ; Thu, 18 Jan 1996 01:33:06 -0800 (PST) Received: (from torek@localhost) by bsdi.BSDI.COM (8.6.12/8.6.12) id CAA22395; Thu, 18 Jan 1996 02:33:03 -0700 Date: Thu, 18 Jan 1996 02:33:03 -0700 From: Chris Torek Message-Id: <199601180933.CAA22395@bsdi.BSDI.COM> To: jkh@time.cdrom.com, markd@grizzly.com Subject: Re: Change to stdio.h to export `cookie?' Cc: hackers@freebsd.org Sender: owner-hackers@freebsd.org Precedence: bulk >If fd is -1, as it is when uninitialized ... It is not uninitialized, it is deliberately set to -1 to mean `not associated with a file descriptor'. There is no reasonable nonnegative value to put here, since there is no (theoretical) limit on the number of descriptors per process. >#define fpending(fp) ((fp)->_p - (fp)->_bf._base) Probably not a bad idea, though this is only correct for write-mode. A more general version might be proposed and sent to ANSI for C9X... >#define fcookie(fp) ((fp)->_cookie) This (a) assumes that there is some magic value associated with a `FILE *' and (b) that it has meaning to someone outside the read/write/ seek/close functions. I find this suspicious. Were stdio a C++ thing, fp->_cookie would be a private member.... >#define ffd(fp) ((fp)->_file) Same as existing fileno(fp). Chris