stdio broken in SysV?
Thomas Tornblom
thomas at uplog.se
Fri Mar 2 01:05:29 AEST 1990
In article <0S&#P?$@masalla.fulcrum.bt.co.uk> igb at fulcrum.bt.co.uk (Ian G Batten) writes:
rpw3 at 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 at uplog.se
Snail mail: TeleLOGIC Uppsala AB Phone: +46 18 189406
Box 1218 Fax: +46 18 132039
S - 751 42 Uppsala, Sweden
More information about the Comp.unix.wizards
mailing list