QNX 6.2: substitute for dev_fdinfo()

bridged with qdn.public.porting
Post Reply
Guest

QNX 6.2: substitute for dev_fdinfo()

Post by Guest » Tue Oct 22, 2002 1:39 pm

Basicly I was looking for a replacement for dev_fdinfo(), to find out,
if a task or one of it's parents is connected to a socket (or not) and
what the local and remote IP adresses are.

In QNX4 we used something like

for(pid = getpid(); pid>PROC_PID; pid = ParentOf(pid))
{


Call dev_fdinfo(pid,...) for stdin and stdout
and find out if one of them is a socket;

Return local and remote IP address;


}

which does pretty much the same as 'sin -p<pid> fd':

MyApplication:

PROGRAM PID
//9/bin/sin 31969
0 -//9/dev/ttyp6
1 -//9/dev/ttyp6
2 -//9/dev/ttyp6

Father:

PROGRAM PID
//9/bin/ksh 10213
0 -//9/dev/ttyp6
1 -//9/dev/ttyp6
2 -//9/dev/ttyp6
10C-//9/dev/ttyp6

Grandfather:

PROGRAM PID
//9/*/usr/ucb/telnetd 8668
0 -//9 T 10.250.3.9.23 10.250.3.31.33401 ESTABLISHED
1 -//9 T 10.250.3.9.23 10.250.3.31.33401 ESTABLISHED
2 -//9 T 10.250.3.9.23 10.250.3.31.33401 ESTABLISHED
3C-//9/dev/ptyp6

I wonder, how I could achieve the same with QNX6 -- not necessarily
with dev_fdinfo().


Any hints are appreciated!

Karsten.

--
__ __ ____ ____
| \/ | __ ) ___| Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |\/| | _ \___ \ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |_) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|_| |_|____/____/ Mobile: +49-172-3812373 D-47809 Krefeld

David Gibbs

Re: QNX 6.2: substitute for dev_fdinfo()

Post by David Gibbs » Tue Oct 22, 2002 2:45 pm

Karsten.Hoffmann@mbs-software.de wrote:
Basicly I was looking for a replacement for dev_fdinfo(), to find out,
if a task or one of it's parents is connected to a socket (or not) and
what the local and remote IP adresses are.
The migration guide says:

dev_fdinfo()
QNX Neutrino equivalent:
No longer supported.
In migration library?
No
You can't get all the information, but you can get bits and
pieces elsewhere.

You might take a look at ConnectClientInfo() and ConnectServerInfo().

This will at least tell you who the fds are connected to.

In QNX4 we used something like

for(pid = getpid(); pid>PROC_PID; pid = ParentOf(pid))
{


Call dev_fdinfo(pid,...) for stdin and stdout
and find out if one of them is a socket;

Return local and remote IP address;
I don't know of a way to get the IP address from outside the
process.

Grandfather:

PROGRAM PID
//9/*/usr/ucb/telnetd 8668
0 -//9 T 10.250.3.9.23 10.250.3.31.33401 ESTABLISHED
1 -//9 T 10.250.3.9.23 10.250.3.31.33401 ESTABLISHED
2 -//9 T 10.250.3.9.23 10.250.3.31.33401 ESTABLISHED
3C-//9/dev/ptyp6
"sin fd" under QNX6 doesn't give the IP addresses or socket status,
it just reports the fd as being connected to the pid of io-net.
I wonder, how I could achieve the same with QNX6 -- not necessarily
with dev_fdinfo().
I don't think so.

-David
--
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Guest

Re: QNX 6.2: substitute for dev_fdinfo()

Post by Guest » Wed Oct 23, 2002 5:49 am

David Gibbs <dagibbs@qnx.com> wrote:
The migration guide says:

dev_fdinfo()
QNX Neutrino equivalent:
No longer supported.
In migration library?
No
You can't get all the information, but you can get bits and
pieces elsewhere.
I've read this (unfortunately there are quite a lot of 'nor supported'
items :-(
You might take a look at ConnectClientInfo() and ConnectServerInfo().

This will at least tell you who the fds are connected to.
I'll dig into this ..

A little frustrating, but thank you for the quick answer, anyway.

Best regards,

Karsten Hoffmann.

--
__ __ ____ ____
| \/ | __ ) ___| Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |\/| | _ \___ \ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |_) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|_| |_|____/____/ Mobile: +49-172-3812373 D-47809 Krefeld

Post Reply

Return to “qdn.public.porting”