2

I'm very new to unix programming, so please bear with me. :)

I'd like to pass data between two processes. I was going to use named pipes, but read about these "half-duplex" pipes, and it was very intriguing, so I figured that I would give them a try first.

I have two issues with these pipes thus far:

  1. I haven't figured out how to get execlp to run another application from my child process
  2. Even if I could, debugging is tough because I've only been able to set breakpoints in the parent process

I'm sure there are reasons for these issues. I am starting to wonder if it makes sense to just forget about them and just use named pipes so I can debug each application in a separate instance of eclipse.

If there is any relevant information, please let me know. The code I am using is essentially what it found on tldp.org.

EDIT -- I renamed my question to be about unix pipes in general. I had assumed that for named pipes, I wouldn't have to use fork(), but all of the examples I have seen so far require it. So regardless of half-duplex or named pipes, I'm going to need to be able to debug the child process somehow!

EDIT #2 -- this example clearly shows that what I had seen before (on an IBM link) regarding named pipes wasn't necessarily true.

Community
  • 1
  • 1
Dave
  • 14,618
  • 13
  • 91
  • 145

1 Answers1

1

I recommend two tools:

  • strace -ff should give you a trace of all significant events, allowing you to examine in detail what's going on, namely, all reads and writes;

  • lsof allows you to dump file descriptors of involved processes, clearly showing what is connected to what else and, in particular, if you forgot to close() some descriptors and the whole thing deadlocks.

jop
  • 2,226
  • 15
  • 16