*BSD News Article 2627


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!mips!mips!sdd.hp.com!uakari.primate.wisc.edu!ames!sgi!fido!zola!twilight!zuni!anchor!olson
From: olson@anchor.esd.sgi.com (Dave Olson)
Newsgroups: comp.unix.bsd
Subject: Re: Beware of fileno()
Keywords: sunos, ultrix, stdio, fileno, lossage, irix
Message-ID: <nrg0vuk@zuni.esd.sgi.com>
Date: 28 Jul 92 03:06:39 GMT
References: <14njaeINNvk@agate.berkeley.edu> <1992Jul24.062320.2170@kithrup.COM> <1992Jul24.141048.10911@aosg.gsf.dec.com> <1217@ki.com>
Sender: news@zuni.esd.sgi.com (Net News)
Organization: Silicon Graphics, Inc.  Mountain View, CA
Lines: 32

In <1217@ki.com> dwatts@ki.com (Dan Watts) writes:

| In article <1992Jul24.141048.10911@aosg.gsf.dec.com> reeves@decvax.dec.com writes:
| ||> >Sean Eric Fagan   |> Andreas Stolcke
| ||> >... fileno() returns a char field in the FILE structure...one has to use
| ||> >	(unsigned char)fileno(stream) 
| ||> Current BSD sources have the _file element as a short.
| |
| |The same change went into ULTRIX over a year ago; I believe it's been released
| |for nearly a year (it was definitely in V4.2, which isn't even the current
| |release any more).
| |-- 
| |Jon Reeves	Digital Equipment Corporation, Alpha Open Systems Group
| |		5 Wentworth Drive, MS GSF1-1K13, Hudson NH 03051-4929 USA
| |+1 603 884 5859	reeves@decvax.dec.com	FAX: +1 603 884 1685
| 
| SGI Irix 4.0.1 still has it as "char _file;".  I wonder if they've
| fixed it yet?  Luckily, the default behaviour for the SGI C compiler
| is to treat all chars as unsigned.

We only go up to 100 files per process by default; 200 can be
configured in 4.0.5 though.  In any case, characters are unsigned by
default.  If you use  -signed when compiling, and you configure the
system for more files per process, then yes, this could be a problem,
EXCEPT, that stdio will deal with at most 100 files, even if the system
limit is configured higher, so it is pretty unlikely, although not
impossible, for this to be a problem.

--
Let no one tell me that silence gives consent,  |   Dave Olson
because whoever is silent dissents.             |   Silicon Graphics, Inc.
    Maria Isabel Barreno                        |   olson@sgi.com