Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site druxr.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!drutx!druxr!gsc From: gsc@druxr.UUCP (CageG) Newsgroups: net.unix Subject: stdout buffering question Message-ID: <749@druxr.UUCP> Date: Fri, 12-Apr-85 13:14:14 EST Article-I.D.: druxr.749 Posted: Fri Apr 12 13:14:14 1985 Date-Received: Sat, 13-Apr-85 05:38:21 EST Expires: Thu, 18-Apr-85 02:00:00 EST Organization: AT&T Information Systems Laboratories, Denver Lines: 22 I am trying to exec a child with its standard in, out and error directed to pipes. I have managed to accomplish this in two different ways, closing the std stuff, duping to the pipes and by execing the shell with appropriate arguments. The snag I have run into is that it appears that when a process is execed the operating system does you a favor and make stdout buffered. The result is that nothing is written into the pipe for stdout until the child flushes stdout or the child exits. If in the child the buffer size is set to 0 using setbuf then every thing works fine. However one constraint for what I am trying to do is that no changes (like adding the setbuf call) can be made to the child process. Calling setbuf after I fork but before the exec doesn't seem to work. The decision to have buffered output seems to be done at exec time. Does anyone have any idea how to exec a process and have it maintain the same buffering characteristics as the parent or how to exec a process and disable the assignment of buffering to stdout outside the child process? I am out of ideas and am just about to abandon this redirection problem. Any thoughts or ideas would be greatly appreciated. Thanks Gary Cage druxr!gsc (303) 538-4947