Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error Explainations?

407 views
Skip to first unread message

taa...@sandia.gov

unread,
Jul 14, 2000, 3:00:00 AM7/14/00
to
Hi,

How do I go about finding out what an errno code *means*. I know how
to get the name of the status code (e.g. S_objLib_OBJ_UNAVAILABLE),
but I don't know where to look for a description of what this means
and which system calls can generate it.

I have two specific instances:

1) When I dump the task info in the shell (using 'i'), I see a task
with its errno set to non-zero.

2) I make a system call and get an errno whose meaning isn't
immediately obvious to me (e.g. S_objLib_OBJ_UNAVAILABLE or
S_errno_EPERM).

Thanks,
Tad


Joe Durusau

unread,
Jul 14, 2000, 3:00:00 AM7/14/00
to
You would have to look at the man pages for the lib in question,
or at the printed docs. Be advised that errno is without meaning unless
a
function has returned an error to its caller. In other words, don't
write
code that checks errno after a unctoin call unless the function has
returned
in such a way as to make you believe that the function has failed.

Speaking only for myself,

Joe Durusau

taa...@sandia.gov

unread,
Jul 14, 2000, 3:00:00 AM7/14/00
to
Joe Durusau <dur...@delphi.com> writes:
> You would have to look at the man pages for the lib in question,
> or at the printed docs. Be advised that errno is without meaning unless a
> function has returned an error to its caller. In other words, don't write
> code that checks errno after a unctoin call unless the function has returned
> in such a way as to make you believe that the function has failed.
>
> Speaking only for myself,
>
> Joe Durusau

I'm on an NT host, so there are no man pages (AFIK). There are online
documents (html), but they are identical to the printed documents.
The documentation I have looks like this:

------------------------------------------------------------
msgQSend( )

(snip)

ERRNO
S_distLib_NOT_INITIALIZED, S_objLib_OBJ_ID_ERROR,
S_objLib_OBJ_DELETED, S_objLib_OBJ_UNAVAILABLE,
S_objLib_OBJ_TIMEOUT, S_msgQLib_INVALID_MSG_LENGTH,
S_msgQLib_NON_ZERO_TIMEOUT_AT_INT_LEVEL
------------------------------------------------------------

Most of the names in the ERRNO section are reasonable obvious, but
how do I find out what S_objLib_OBJ_UNAVAILABLE means?

I understand your statement about checking the return value before
looking at errno, but I think that you've missed my point. I have a
task that is running with an errno of 0. After awhile, the errno
changes to S_errno_EPERM. I'd like to know what this errno means and
what caused it. I understand that it *may* be something that I don't
care about, but how do I go about convincing myself that this
situation is acceptable?

Thanks,
Tad


Andrew Johnson

unread,
Jul 14, 2000, 3:00:00 AM7/14/00
to
taa...@sandia.gov wrote:
>
> I understand your statement about checking the return value before
> looking at errno, but I think that you've missed my point. I have a
> task that is running with an errno of 0. After awhile, the errno
> changes to S_errno_EPERM. I'd like to know what this errno means and
> what caused it. I understand that it *may* be something that I don't
> care about, but how do I go about convincing myself that this
> situation is acceptable?

This value of errno may have been set by some call made internally by a
vxWorks library that knows how to deal with the error itself and thus be
of no consequence to you. Unless you have been given an error return by a
function called by your software then the errno value is irrelevent. Our
systems have many tasks running, and a fair proportion of them report a
non-zero errno even when nothing's wrong.

To convince yourself that there's nothing wrong, perhaps you could write a
little test macro that checks errno, prints a message whenever it's
non-zero and resets it to zero, and then call this after a representative
sample of *successful* vxWorks function calls inside your application -
that way you'll see when it changes.

- Andrew
--
Sharks kill 10 people each year. People kill 60,000,000 sharks each year.

Derek Opitz

unread,
Jul 14, 2000, 3:00:00 AM7/14/00
to
Maybe i'm miss understanding the question, but printErrno() will return a
string description of the errno.

Andrew Johnson <a...@aps.anl.gov> wrote in message
news:396F59F5...@aps.anl.gov...

Joe Durusau

unread,
Jul 17, 2000, 3:00:00 AM7/17/00
to
Be advised that I'm using Tornado 1, so your system may be
different. However, on that system, FWIW, the only user functions
that return this error are msgQSend and msgQReceive. For msgQSend,
the error means that NO_WAIT was set, and that there was no space
in the send que. For msgQReceive, it means that NO_WAIT was set,
and there was no message available. If it makes a difference, my system
is running in unix, and configured for 68xxx.

Speaking only for myself,

Joe Durusau


taa...@sandia.gov wrote:
>
> Joe Durusau <dur...@delphi.com> writes:
> > You would have to look at the man pages for the lib in question,
> > or at the printed docs. Be advised that errno is without meaning unless a
> > function has returned an error to its caller. In other words, don't write
> > code that checks errno after a unctoin call unless the function has returned
> > in such a way as to make you believe that the function has failed.
> >
> > Speaking only for myself,
> >
> > Joe Durusau
>
> I'm on an NT host, so there are no man pages (AFIK). There are online
> documents (html), but they are identical to the printed documents.
> The documentation I have looks like this:
>
> ------------------------------------------------------------
> msgQSend( )
>
> (snip)
>
> ERRNO
> S_distLib_NOT_INITIALIZED, S_objLib_OBJ_ID_ERROR,
> S_objLib_OBJ_DELETED, S_objLib_OBJ_UNAVAILABLE,
> S_objLib_OBJ_TIMEOUT, S_msgQLib_INVALID_MSG_LENGTH,
> S_msgQLib_NON_ZERO_TIMEOUT_AT_INT_LEVEL
> ------------------------------------------------------------
>
> Most of the names in the ERRNO section are reasonable obvious, but
> how do I find out what S_objLib_OBJ_UNAVAILABLE means?
>

> I understand your statement about checking the return value before
> looking at errno, but I think that you've missed my point. I have a
> task that is running with an errno of 0. After awhile, the errno
> changes to S_errno_EPERM. I'd like to know what this errno means and
> what caused it. I understand that it *may* be something that I don't
> care about, but how do I go about convincing myself that this
> situation is acceptable?
>

> Thanks,
> Tad

john_...@my-deja.com

unread,
Jul 18, 2000, 3:00:00 AM7/18/00
to
In article <39731B1D...@delphi.com>,

Joe Durusau <dur...@delphi.com> wrote:
> Be advised that I'm using Tornado 1, so your system may be
> different. However, on that system, FWIW, the only user functions
> that return this error are msgQSend and msgQReceive. For msgQSend,
> the error means that NO_WAIT was set, and that there was no space
> in the send que. For msgQReceive, it means that NO_WAIT was set,
> and there was no message available. If it makes a difference, my
system
> is running in unix, and configured for 68xxx.

This is not entirely accurate... other system functions including
semTake() & taskDelete() when a timeout of NO_WAIT is specified and the
operation cannot succeed immediately.

Hope that helps,

John...


Sent via Deja.com http://www.deja.com/
Before you buy.

Dave Korn

unread,
Jul 18, 2000, 3:00:00 AM7/18/00
to
taa...@sandia.gov wrote in message ...

>Joe Durusau <dur...@delphi.com> writes:
>> You would have to look at the man pages for the lib in question,
>> or at the printed docs. Be advised that errno is without meaning unless
a
>> function has returned an error to its caller. In other words, don't
write
>> code that checks errno after a unctoin call unless the function has
returned
>> in such a way as to make you believe that the function has failed.
>>
>> Speaking only for myself,
>>
>> Joe Durusau
[...snip!...]

>I understand your statement about checking the return value before
>looking at errno, but I think that you've missed my point. I have a
>task that is running with an errno of 0. After awhile, the errno
>changes to S_errno_EPERM. I'd like to know what this errno means and
>what caused it. I understand that it *may* be something that I don't
>care about, but how do I go about convincing myself that this
>situation is acceptable?
>
>Thanks,
>Tad

If you say this, you _haven't_ understood his statement. It isn't that

>it *may* be something that I don't care about

it is that it is something which you are explicitly _forbidden_ by the
design of the OS and environment from caring about. The OS calls many
of its own routines itself internally that may set errno to various values;
it handles error returns from its own function calls. Since errno never gets
reset to zero, what you are seeing is _meaningless_; the most it could ever
represent is an error that happened an unknown and arbitrary amount of time
ago and that was _already_handled_ by the OS. Functions in the OS are at
liberty to set errno to any value they like at any time whether there's an
error or not; they could for instance use it as a way of returning an
extra result from a function, or they could speculatively set it to an
error that might happen, and then return OK if the error didn't happen. It
is almost always a mistake to try and second guess the internals of your
implementation.

In this particular case, what you are seeing is the leftover traces of
something internal to the OS. My guess would be that message queues are
used internally somewhere in the I/O library to pass chunks of data to and
from the device drivers, and that either your task recently called a read()
function that checked the 'received data' queue, found it empty (setting
errno) and returned to your function with NO ERROR and zero bytes read,
or that your task called a write() function which tried to put data onto an
'outgoing data' queue, found it full, tried again and completed
successfully, leaving errno set from the first try, but correctly returning
NO ERROR to your application.

IOW, worrying about the value of errno when the OS function has returned
OK to your code is worth spending about the same amount of time on as
worrying what values are in auto (function local) variables when their
function isn't running. None.

DaveK
--
"Reality is whatever doesn't go away after you stop believing in it."
-- Philip K. Dick

Paddy

unread,
Jul 19, 2000, 3:00:00 AM7/19/00
to
Hi there,
I usually look at the header file in question but sometimes it can be
hard to find the right header file. Errno values can be split into two parts
the upper 16 bits is the offending module number and the lower 16 bits is
the actual error code. There is a Header file vxModNum.h (I think) that
specifies the upper 16 bits for each error source type. Rather than tracing
it down by looking through many h files I usually (from the host based
shell) use printErrno (0x....) and this will usually give some text like
S_objLib_OBJ_UNAVAILABLE for example. Then I search the header files for
this text and the header file usually gives some description about the
errno. However there may be many reasons for an errno being generated for
example the OBJ_UNAVAILABLE errno above can be generated by msgQ's
Semaphores etc. Unfortunately sometimes the only real way to determine why
some vxWorks call has set the errno to a specific value is to look at the
source code. This usually involves a call to WRS Tech support.
The Library reference will usually give most of the possible errno values a
function might result in but in my experience they are not always all
covered.


Hope this helps,
Patrick
<taa...@sandia.gov> wrote in message news:uvgy8r...@sandia.gov...

0 new messages