ioctl()

I’m trying to obtain statistics of ethernet interface. I do SIOCGIFCONF
request
to get list of intefaces and then … what to do then? According to ioctl.h,
all socket
i/o operate either with “ifconf” structure or “ifreq”… i don’t see how to
get data into
“ifnet” structure containing needed for me members: input/output errors
number, number
of sent/received packets, etc…

Thanks in advance,
Altair

Altair <altair@ua.fm> wrote:

I’m trying to obtain statistics of ethernet interface. I do SIOCGIFCONF
request
to get list of intefaces and then … what to do then? According to ioctl.h,
all socket
i/o operate either with “ifconf” structure or “ifreq”… i don’t see how to
get data into
“ifnet” structure containing needed for me members: input/output errors
number, number
of sent/received packets, etc…

Look into your /usr/demo/src/socket/if_example.c

-xtang

“Xiaodan Tang” <xtang@qnx.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:ap285l$g7c$1@nntp.qnx.com

Altair <> altair@ua.fm> > wrote:
I’m trying to obtain statistics of ethernet interface. I do SIOCGIFCONF
request
to get list of intefaces and then … what to do then? According to
ioctl.h,
all socket
i/o operate either with “ifconf” structure or “ifreq”… i don’t see
how to
get data into
“ifnet” structure containing needed for me members: input/output errors
number, number
of sent/received packets, etc…

Look into your /usr/demo/src/socket/if_example.c

I do know about if_example.c. Unfortunately it doesn’t demonstrate how to
fill ifnet
structure with datas. No problem with obtaining flags/addresses/… The
question is how
to get interface statistics stored in ifnet structure.

Thanks,
Altair

-xtang

Altair <altair@ua.fm> wrote:

“Xiaodan Tang” <> xtang@qnx.com> > ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:ap285l$g7c$> 1@nntp.qnx.com> …
Altair <> altair@ua.fm> > wrote:
I’m trying to obtain statistics of ethernet interface. I do SIOCGIFCONF
request
to get list of intefaces and then … what to do then? According to
ioctl.h,
all socket
i/o operate either with “ifconf” structure or “ifreq”… i don’t see
how to
get data into
“ifnet” structure containing needed for me members: input/output errors
number, number
of sent/received packets, etc…

Look into your /usr/demo/src/socket/if_example.c

I do know about if_example.c. Unfortunately it doesn’t demonstrate how to
fill ifnet
structure with datas. No problem with obtaining flags/addresses/… The
question is how
to get interface statistics stored in ifnet structure.

Oops, I thought you are looking for interfaces…

No, you can not extract those informations. netstat have special
arrangement with stack to get those informations.

You either have to obtain netstat source from your sales rep, or
you have to popen(“netstat -ni”, …), and parse the output.

-xtang