Strange error message from inetstatShow - VxWorks
This is a discussion on Strange error message from inetstatShow - VxWorks ; Hi everyone...
I have a pretty old downloadable application that was originally
developed under Tornado2.0. I've had to make a small change to my C
code, in the Tornado 2.2 environment, and I've run into some problems:
1--The size of ...
-
Strange error message from inetstatShow
Hi everyone...
I have a pretty old downloadable application that was originally
developed under Tornado2.0. I've had to make a small change to my C
code, in the Tornado 2.2 environment, and I've run into some problems:
1--The size of my executable is 10K smaller then my old executable.
This was my first hint of a problem, since the all I did in my change
was modify some arithmetic in one module.
2--At Boottime, I call "InetstatShow", and get the following error:
"Show routine of this object not configured into system"
3--I then do the following line:
if ((nfound = select(FD_SETSIZE, &readfds, 0, 0, &timeout)) == -1)
assert(0); /* Handle_Messages: select failed */
And the program fails at the Select statement, and crashes.
My initial thought was that somehow a library isn't getting included
correctly, but I don't get any errors at compile time, and all my
include statements seem to be right.
Is it possible that the problem I'm running into is because I'm trying
to run a program built using Tornado 2.2 on a Tornado 2.0 kernel?
Should I try building a new kernel and see if that solves things?
And just to make things even better, Wind River has decided to shut down
their tech-support yesterday and today.
Thanks in advance...
Dave Reid
University of Washington Medical Center
-
Re: Strange error message from inetstatShow
Dave Reid wrote:
>Hi everyone...
>
>I have a pretty old downloadable application that was originally
>developed under Tornado2.0. I've had to make a small change to my C
>code, in the Tornado 2.2 environment, and I've run into some problems:
>
>1--The size of my executable is 10K smaller then my old executable.
>This was my first hint of a problem, since the all I did in my change
>was modify some arithmetic in one module.
>
>2--At Boottime, I call "InetstatShow", and get the following error:
>"Show routine of this object not configured into system"
>
>3--I then do the following line:
>if ((nfound = select(FD_SETSIZE, &readfds, 0, 0, &timeout)) == -1)
> assert(0); /* Handle_Messages: select failed */
>
>And the program fails at the Select statement, and crashes.
>
>My initial thought was that somehow a library isn't getting included
>correctly, but I don't get any errors at compile time, and all my
>include statements seem to be right.
I suspect you mean at link time or, more generically, at build time.
In any event, it is perfectly normal for unincluded libraries to not
generate errors when building downloadable applications. This is because
such applications cannot know at build time what has been included in the
OS image into which it will be loaded and unresolved references have to
be allowed. Loading includes a final link step to resolve all symbols,
however, and unrosoled symbols should result in errors at that time.
Look carefully at the console output when the application is loaded.
It certainly seems that the netShow and selectLib libraries are missing
or...
>Is it possible that the problem I'm running into is because I'm trying
>to run a program built using Tornado 2.2 on a Tornado 2.0 kernel?
>Should I try building a new kernel and see if that solves things?
....this might be the problem, especially if the relevant T2.2 library
function names have changed. I don't know that those names have changed
but, if so, you will need to change their names in your application, too.
>And just to make things even better, Wind River has decided to shut down
>their tech-support yesterday and today.
Yeah, huh?
>Thanks in advance...
HTH
--
================================================== ======================
Michael Kesti | "And like, one and one don't make
| two, one and one make one."
mrkesti at comcast dot net | - The Who, Bargain
-
Re: Strange error message from inetstatShow
Dave:
First off, the command is inetstatShow - no initial caps.Under the
tornado configuator for the kernel, there are lots of "show" routines
that you can add in or leave out. In T2.2, I belive the default is to
leave most of them out. Do things like netstatShow, tcpStatShow work?
Redo the kernel and you may be in business.
As alast resort, the source for inetstatShow is available. Here it it
(note it's new superInetstatShow and a new last col - the fd of the
socket)
Here's some example code:
------------------------------- cut here
--------------------------------------
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
const static char *tcpState[] = {
"CLOSED", "LISTEN", "SYN_SENT", "SYN_RECD", "ESTABLISHED",
"CLOSE_WAIT", "FIN_WAIT_1", "CLOSING", "LAST_ACK", "FIN_WAIT_2",
"TIME_WAIT", "UNKNOWN"
};
extern struct inpcbhead tcpcb;
extern struct inpcbhead udb;
static char *fmtIpAddr( u_long addr, short port, char *s)
{
sprintf (s, "%ld.%ld.%ld.%ld.%d",
(addr >> 24) & 0xff,
(addr >> 16) & 0xff,
(addr >> 8) & 0xff,
(addr >> 0) & 0xff,
port);
return s;
}
void superInetstatShow (void)
{
struct inpcb *p;
char addrStr[32];
short state;
struct tcpcb *ptcp;
puts( "Active Internet connections (including servers)");
printf( "%-8.8s %-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %3s %s\n",
"PCB","Proto","Recv-Q","Send-Q","Local Address",
"Foreign Address","fd","(state)");
printf( "%-8.8s %-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %3s %s\n",
"--------","-----","------","------","------------------",
"------------------","---","-------");
p = tcpcb.lh_first;
while (p)
{
state = NELEMENTS(tcpState)-1;
ptcp = (struct tcpcb*)(p->inp_ppcb);
if (ptcp)
{
state = min(ptcp->t_state, NELEMENTS(tcpState)-1);
}
printf ("%-8x TCP %6ld %6ld %-18s",
(unsigned int)p,
p->inp_socket->so_rcv.sb_cc,
p->inp_socket->so_snd.sb_cc,
fmtIpAddr(p->inp_laddr.s_addr, p->inp_lport, addrStr));
printf (" %-18s %3d %-11s\n",
fmtIpAddr(p->inp_faddr.s_addr, p->inp_fport, addrStr),
p->inp_socket->so_fd,
tcpState[state]);
p = p->inp_list.le_next;
}
p = udb.lh_first;
while (p)
{
printf ("%-8x UDP %6ld %6ld %-18s",
(unsigned int)p,
p->inp_socket->so_rcv.sb_cc,
p->inp_socket->so_snd.sb_cc,
fmtIpAddr(p->inp_laddr.s_addr, p->inp_lport, addrStr));
printf (" %-18s %3d\n",
fmtIpAddr(p->inp_faddr.s_addr, p->inp_fport, addrStr),
p->inp_socket->so_fd);
p = p->inp_list.le_next;
}
}
------------------------------------------- end cut
---------------------------
Here's what the output looks like (like inetstatShow, but with the fd
added):
-> superInetstatShow
Active Internet connections (including servers)
PCB Proto Recv-Q Send-Q Local Address Foreign Address fd
(state)
-------- ----- ------ ------ ------------------ ------------------ ---
-------
76d4a2c TCP 0 0 0.0.0.0.514 0.0.0.0.0 17
LISTEN
76d48a0 TCP 0 0 0.0.0.0.111 0.0.0.0.0 11
LISTEN
76d4714 TCP 0 0 0.0.0.0.9323 0.0.0.0.0 8
LISTEN
76d4504 TCP 0 0 0.0.0.0.9321 0.0.0.0.0 5
LISTEN
76d49a8 UDP 0 0 0.0.0.0.9368 0.0.0.0.0 16
76d4924 UDP 0 0 0.0.0.0.9306 0.0.0.0.0 15
76d481c UDP 0 0 0.0.0.0.111 0.0.0.0.0 10
76d4798 UDP 0 0 0.0.0.0.9369 0.0.0.0.0 9
76d4690 UDP 0 0 127.0.0.1.1024 127.0.0.1.17185 7
76d460c UDP 0 0 0.0.0.0.17185 0.0.0.0.0 6
value = 24 = 0x18
Good luck, LarryC
-
Re: Strange error message from inetstatShow
Dave:
First off, the command is inetstatShow - no initial caps.Under the
tornado configuator for the kernel, there are lots of "show" routines
that you can add in or leave out. In T2.2, I belive the default is to
leave most of them out. Do things like netstatShow, tcpStatShow work?
Redo the kernel and you may be in business.
As alast resort, the source for inetstatShow is available. Here it it
(note it's new superInetstatShow and a new last col - the fd of the
socket)
Here's some example code:
------------------------------- cut here
--------------------------------------
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
const static char *tcpState[] = {
"CLOSED", "LISTEN", "SYN_SENT", "SYN_RECD", "ESTABLISHED",
"CLOSE_WAIT", "FIN_WAIT_1", "CLOSING", "LAST_ACK", "FIN_WAIT_2",
"TIME_WAIT", "UNKNOWN"
};
extern struct inpcbhead tcpcb;
extern struct inpcbhead udb;
static char *fmtIpAddr( u_long addr, short port, char *s)
{
sprintf (s, "%ld.%ld.%ld.%ld.%d",
(addr >> 24) & 0xff,
(addr >> 16) & 0xff,
(addr >> 8) & 0xff,
(addr >> 0) & 0xff,
port);
return s;
}
void superInetstatShow (void)
{
struct inpcb *p;
char addrStr[32];
short state;
struct tcpcb *ptcp;
puts( "Active Internet connections (including servers)");
printf( "%-8.8s %-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %3s %s\n",
"PCB","Proto","Recv-Q","Send-Q","Local Address",
"Foreign Address","fd","(state)");
printf( "%-8.8s %-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %3s %s\n",
"--------","-----","------","------","------------------",
"------------------","---","-------");
p = tcpcb.lh_first;
while (p)
{
state = NELEMENTS(tcpState)-1;
ptcp = (struct tcpcb*)(p->inp_ppcb);
if (ptcp)
{
state = min(ptcp->t_state, NELEMENTS(tcpState)-1);
}
printf ("%-8x TCP %6ld %6ld %-18s",
(unsigned int)p,
p->inp_socket->so_rcv.sb_cc,
p->inp_socket->so_snd.sb_cc,
fmtIpAddr(p->inp_laddr.s_addr, p->inp_lport, addrStr));
printf (" %-18s %3d %-11s\n",
fmtIpAddr(p->inp_faddr.s_addr, p->inp_fport, addrStr),
p->inp_socket->so_fd,
tcpState[state]);
p = p->inp_list.le_next;
}
p = udb.lh_first;
while (p)
{
printf ("%-8x UDP %6ld %6ld %-18s",
(unsigned int)p,
p->inp_socket->so_rcv.sb_cc,
p->inp_socket->so_snd.sb_cc,
fmtIpAddr(p->inp_laddr.s_addr, p->inp_lport, addrStr));
printf (" %-18s %3d\n",
fmtIpAddr(p->inp_faddr.s_addr, p->inp_fport, addrStr),
p->inp_socket->so_fd);
p = p->inp_list.le_next;
}
}
------------------------------------------- end cut
---------------------------
Here's what the output looks like (like inetstatShow, but with the fd
added):
-> superInetstatShow
Active Internet connections (including servers)
PCB Proto Recv-Q Send-Q Local Address Foreign Address fd
(state)
-------- ----- ------ ------ ------------------ ------------------ ---
-------
76d4a2c TCP 0 0 0.0.0.0.514 0.0.0.0.0 17
LISTEN
76d48a0 TCP 0 0 0.0.0.0.111 0.0.0.0.0 11
LISTEN
76d4714 TCP 0 0 0.0.0.0.9323 0.0.0.0.0 8
LISTEN
76d4504 TCP 0 0 0.0.0.0.9321 0.0.0.0.0 5
LISTEN
76d49a8 UDP 0 0 0.0.0.0.9368 0.0.0.0.0 16
76d4924 UDP 0 0 0.0.0.0.9306 0.0.0.0.0 15
76d481c UDP 0 0 0.0.0.0.111 0.0.0.0.0 10
76d4798 UDP 0 0 0.0.0.0.9369 0.0.0.0.0 9
76d4690 UDP 0 0 127.0.0.1.1024 127.0.0.1.17185 7
76d460c UDP 0 0 0.0.0.0.17185 0.0.0.0.0 6
value = 24 = 0x18
Good luck, LarryC