Xref: utzoo comp.unix.wizards:20827 comp.bugs.sys5:1234 Path: utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!sunic!sics.se!uplog.se!uplog.uplog.se!thomas From: thomas@uplog.se (Thomas Tornblom) Newsgroups: comp.unix.wizards,comp.bugs.sys5 Subject: Re: stdio broken in SysV? Message-ID: Date: 1 Mar 90 14:05:29 GMT References: <2010@sauron.Columbia.NCR.COM> <51697@sgi.sgi.com> <0S&#P?$@masalla.fulcrum.bt.co.uk> Sender: thomas@uplog.se (Thomas Tornblom) Organization: TeleLOGIC Uppsala AB Lines: 50 In-Reply-To: igb@fulcrum.bt.co.uk's message of 26 Feb 90 09:32:10 GMT In article <0S&#P?$@masalla.fulcrum.bt.co.uk> igb@fulcrum.bt.co.uk (Ian G Batten) writes: rpw3@rigden.UUCP (Robert P. Warnock) writes: > This is a well-known problem to anyone who has ported any Berkeley networking > applications to System V. IMHO, Sys5's broken, but it's that way in all the > S5R2's I've seen. (Did it make it into S5R3? Will it still be there in S5R4?) Yes. I ported IDA Sendmail to 5.3.2 last week and hit this problem. As previously stated, dup()ing the file descriptor is a cure. If anyone cares, here is the fix to stdio I made. I also came across the problem while bringing sendmail up. Requires source of course... ----------------------------------------------- There is only 3 files that need a change. /usr/include/stdio.h: Add a new member last to the FILE struct: unsigned char *_bufendp; /* get rid of bufendtab */ redefine the macro _bufend(): #define _bufend(p) ((p)->_bufendp) remove the definition of _bufendtab[] .../src/lib/libc/port/data.c: add a new initializer to the _iob[] struct for stdin, stdout and stderr: FILE _iob[_NFILE] = { { 0, NULL, NULL, _IOREAD, 0, NULL}, { 0, NULL, NULL, _IOWRT, 1, NULL}, { 0, _smbuf[2], _smbuf[2], _IOWRT+_IONBF, 2, _smbuf[2]+_SBFSIZ}, }; remove the declaration of _bufendtab[]; .../src/lib/libc/port/print/doprnt.c There is one place where _bufendtab[fno] is referenced. Change it to _bufend(iop). This can be done without the other changes. Then you have to recompile libc.a of course, but thats another story. Thomas -- Real life: Thomas Tornblom Email: thomas@uplog.se Snail mail: TeleLOGIC Uppsala AB Phone: +46 18 189406 Box 1218 Fax: +46 18 132039 S - 751 42 Uppsala, Sweden