home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sun.misc
- Path: sparky!uunet!gatech!europa.asd.contel.com!gte4.tsc.gtefsd.com!warren
- From: warren@orion.tsc.gtefsd.com (Hugh Warren)
- Subject: Are many open streams possible?
- Message-ID: <1992Sep14.160327.7847@europa.asd.contel.com>
- Sender: warren@gte4.tsc.gtefsd.com (Hugh Warren)
- Nntp-Posting-Host: gte4.tsc.gtefsd.com
- Organization: GTE-FSD in Chantilly, Virginia.
- Date: Mon, 14 Sep 1992 16:03:27 GMT
- Lines: 28
-
- (System: SPARCstation 2, SunOS 4.1.2)
-
- In my program I use setrlimit() to set RLIMIT_NOFILE to 255, then
- use fopen() to open around 250 files (Yes, that many open files
- are needed). But then fwrite(), fclose(), and fflush() (probably
- other functions too) fail on streams 128-250. I traced down the
- following in stdio.h:
- ...
- extern struct _iobuf {
- int _cnt;
- unsigned char *_ptr;
- unsigned char *_base;
- int _bufsiz;
- short _flag;
- char _file; /* should be short */
- } _iob[];
- ...
- where _file is the actual file descriptor number. Having it
- type char limits it to 0-127 before the numbers become negative.
- I tried changing the line to "unsigned char _file;", but
- that won't work since apparently the functions were compiled
- with the "char _file" definition.
-
- If you know how to work with more than 128 open streams at one
- time, then please e-mail me your solution. Thanks for any help.
- Hugh Warren
- warren@orion.tsc.gtefsd.com
-
-