From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ece0aa831b76f79d,start X-Google-Attributes: gid103376,public From: z93john@mtek.chalmers.se (John I Quist) Subject: Opening a fifo hangs Date: 1999/02/18 Message-ID: <7agtmi$8a$1@nyheter.chalmers.se>#1/1 X-Deja-AN: 445659971 Organization: School of Mechanical Engineering, Chalmers University of Technology Newsgroups: comp.lang.ada Date: 1999-02-18T00:00:00+00:00 List-Id: Hi! I'm tring to establish communication between two processes on the same Sun machine. (SunOS 5.6; running GNAT 3.05) I have created two named pipes, and if I open two terminals, I can do the following, without a problem: In /dev/pts/3 (e.g.) cat > mypipe typetypetype ^D In /dev/pts/4 cat mypipe As expected, the text typed into the pipe on "pts/3" arrives neatly on "pts/4"... BUT, if I make a small Ada hack to open the pipes and read/write to them, one program reads and the other writes, the program hangs. The lines where execution halts are: --- Write side --- open(IN_F, IN_FILE, "/users/ztek/z93john/.comm_pipe"); ------------------ --- Read side --- open(OUT_F, OUT_FILE, "/users/ztek/z93john/.comm_pipe"); ----------------- (Both programs use TEXT_IO) If I run "truss" to get the system calls, I find that both programs do open("/users/ztek/z93john/.comm_pipe", O_RDONLY) (sleeping...) BUT; if I kill the "writer" and do a cat > .comm_pipe [Return] the "reader" opens the fifo! Why doesn't the writer open the pipe? I have read the GNAT reference, and I didn't get much wiser... - Is Ada doing something weird here, or is it me? (As I understand it, the programs are supposed to block until both ends of the pipe are open, but that's what I'm doing, isn't it? Open for write on one end, read on the other...) I would really appreciate an email copy of your replies. Thank you! /John.