davidt@ttidca.UUCP (David Terlinden) (04/16/85)
gsc asks about buffering of stdout of execed processes. I say that it's not the fault of the OS but of the stdio library. If the flag field in _iob[1] says to buffer output (the default value), the first output function to stdout will notice this and allocate a buffer. Since _iob is initialized data of the new process, anything you do before the exec has no effect. Can anyone suggest anything other than modifying "putchar()" or "_iob[]"?
john@genrad.UUCP (John Nelson) (04/17/85)
In article <215@ttidca.UUCP> davidt@ttidca.UUCP (David Terlinden) writes: >gsc asks about buffering of stdout of execed processes. I say that it's not >the fault of the OS but of the stdio library. If the flag field in _iob[1] >says to buffer output (the default value), the first output function to stdout >will notice this and allocate a buffer. Since _iob is initialized data of >the new process, anything you do before the exec has no effect. Can anyone >suggest anything other than modifying "putchar()" or "_iob[]"? SURE! Why not write a program to poke around in the executable file, and reset that flag in _iob[1]. This solves the problem of having only a binary. Unfortunately, this won't work if the executable has been "stripped".
ado@elsie.UUCP (Arthur David Olson) (04/20/85)
In article <215@ttidca.UUCP> davidt@ttidca.UUCP (David Terlinden) writes: >gsc asks about buffering of stdout of execed processes. . . >If the flag field in _iob[1] says to buffer output (the default value), >the first output function to stdout will notice this and allocate a buffer. >Since _iob is initialized data of the new process, anything you do before the >exec has no effect. Can anyone suggest anything other than modifying >"putchar()" or "_iob[]"? Here's my wish list solution: before deciding to buffer output, standard input/output library functions would check to see if "DONTBUFFER" (or maybe "BUFFERING=NONE") was present in the environment. If such a beast was present, no buferring would be done. This approach would allow the parent process to control buffering in a way that was transparent to the child process. -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX and Elsie are Digital Equipment and Borden trademarks