in reply to Re^2: How to know STDOUT associated with a process pid
in thread How to know STDOUT associated with a process pid

STDOUT can get you a file descriptor of some sort, right?

It has been many years since I have done this, but the -t test in the shell can tell if it is attached to a file or a pty, so I would guess that you can get to the inode (if applicable) attached to the STDOUT as well.

Some of the other responses on this posting also have good ideas, some even with already written solutions (even the negative responses have some good stuff in them if you dig a little). I would pursue the fstat stuff only if the other stuff on this thread didn't pan out. In fact, it would not surprise me if some of the other solutions even used fstat behind the scenes.

Good luck

--MidLifeXis

  • Comment on Re^3: How to know STDOUT associated with a process pid