-- vic
Nope, not there...
If "#include <errno.h>" doesn't get you the definition for ETIMEDOUT
then your system is broken. That doesn't necessarily mean that
ETIMEDOUT is defined in errno.h -- it could be defined in another
header that errno.h includes.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Yep, there...
Now say something useful, like how you determined that it's "not there."
>
> Now say something useful, like how you determined that it's "not there."
>
grep ETIMEDOUT /usr/include/errno.h
-- vic
Did you also look in any additional headers that errno.h includes?
The point is that "#include <errno.h>" should get you the definition
for ETIMEDOUT whether it's defined in errno.h itself or in a header
that errno.h includes. Have you tried putting "#include <errno.h>"
in your code?
As far as I know all error codes with short description are in include/asm/errno.h
Actualy in my distribution it is /usr/include/asm/errno.h
BTW: grep is very poverful ;)
Good Luck!
Try this instead:
#include <errno.h>
#ifdef ETIMEDOUT
#error found it
#else
#error not there
#endif
This solved my problem. I should have thought of this, but I thank you
for suggesting it. I'm a little surprised that pthread.h on RH Linux
does not include errno.h automatically nor does the man page refer to it.
-- vic
ETIMEDOUT isn't just for threads -- it's a standard error indicating
than an operation timed out. The historical way for a system call
to indicate a failure is to return -1 and store the reason in the
global variable errno; errno and the error values are defined in
<errno.h>, hence the reason for including it. Thread functions and
some other libraries avoid using a global variable and return the
error itself, using a value such as 0 (zero) to indicate success.
In general, if you see a reference to an error beginning with "E"
(ETIMEDOUT, EINVAL, etc.) then you'll probably need to include
<errno.h> to get its definition.
As for <pthread.h> not including <errno.h>, it's typical for a
header not to include headers upon which it doesn't depend, and
even not to include some headers upon which it does depend (e.g.,
<sys/types.h>). The comp.lang.c FAQ has a brief discussion about
whether nested includes are acceptable style:
http://www.eskimo.com/~scs/C-faq/q10.7.html