[VxW] Re: GPF, stack problems?

John john_94501 at yahoo.com
Fri Apr 18 23:55:15 PDT 2003


Hello,

> viofd = ioGlobalStdGet(0)
> ioGlobalStdSet(0,0)
> ioGlobalStdSet(1,1)
> ioGlobalStdSet(2,2)

This is a really bad idea. You have just set the global standard I/O
channels to point to themselves.

> close(viofd)
> #
> viofd=open("/vio/0")
> ioGlobalStdSet(0,viofd)
> ioGlobalStdSet(1,viofd)
> ioGlobalStdSet(2,viofd)

You would be better doing something like this:

tmpfd = ioGlobalStdGet(0)
viofd=open("/vio/0")
ioGlobalStdSet(0,viofd)
ioGlobalStdSet(1,viofd)
ioGlobalStdSet(2,viofd)
close(tmpfd)

That too makes the assumption that all the standard I/O channels will
be using the same FD. Probably OK, but something to think about.

As to why this crashes, I don't know. I can only assume the problem is
that something it trying to read to or write from a standard I/O
channel while you have them looped back on themselves. Once again,
since you gave no information about the actual exception it is
impossible to say what really went wrong.

HTH,
John...

=====
Contribute to the VxWorks Cookbook at
http://www.bluedonkey.org/cgi-bin/twiki/bin/view/Books/WebHome


More information about the VxWexplo mailing list