home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / sun / misc / 4212 < prev    next >
Encoding:
Text File  |  1992-09-14  |  1.4 KB  |  40 lines

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