[ale] how to redirect fds through telnet session in QNX?

Step random4444 at gmail.com
Fri Mar 23 17:20:41 EDT 2007


Hey guys,

I'm trying to figure out a (hopefully simple) problem that I hope someone
can help point me in the right direction on (or at least help me figure out
the right question to ask).

We have an embedded PC running QNX, and a windows (yes, I know :( ) machine
on the "workstation".  Routinely we telnet in to the embedded PC if we need
anything, mainly for troubleshooting / diagnostics.  The problem is that if
there is a software bug, we have to restart our software (set of processes)
on the embedded PC to start seeing messages through the telnet session.  We
use root as the login on QNX (yes, I know :( ).  When we restart, that makes
the bug go away, and we have to wait (sometimes for days) for the problem to
come back.  In the field it is often impractical to connect directly to the
embedded PC, so telnet is our best and first choice.

Here's what I've learned in the last day or two: the messages are just
printf statements, so they just go to stdout.  I know that we can plug a
monitor directly and we see the messages immediately, so they are getting
outputted - the processes are started automatically before we start a telnet
session.  I know now that we have tty, that there are different terminals,
sessions, sockets, and ports involved.  I can see the SID (as well as the
PID and PRGP) of each process of interest with a simple command.

So after doing some checking here I can see that when we connect directly to
embedded, tty is '//130/dev/con1'.  Through the telnet I have
'//130/dev/ttyp0'.  The '130' changes based on the node number, so con1 is
connection 1 (physically its directly to the video output on the PC board).
ttyp0 appears to be a pseudo-terminal.  Further, I can see that the
processes are on SID 0, but if I ps from the direct connection it seems that
is SID 1.  running a command from the telnet session shows that as SID 2.

So now I'm a little confused - I can see the messages from processes started
on SID 0 on SID 1, but not SID 2?  I think maybe I need to know the sockets
or ports, but I'm not sure how to find that out.  I also know about the
redirect command ('>' and '>>'), but I don't just want to redirect a
specific command, I want to redirect the whole stdout of one session to
another (I think).  It would also be valuable to send stdout from the PIDs
of interest to a file, but I wouldn't want to do this all the time, just
when I need to debug.

So I sort of know about piping, and as you can see I've looked up a bunch of
stuff, but I still am not sure what I need to do or even learn about next to
accomplish this.  Anybody happen to know or have any suggestions?  The idea
of "sessions" and "tty" is pretty new to me, but I do want to understand it
as fully as I can.

Any other information I need to provide?  Any pointers would be greatly
appreciated.  :)

Peace,
Step
-------------- next part --------------
An HTML attachment was scrubbed...




More information about the Ale mailing list