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

pthread_cond_timedwait() ETIMEDOUT definition

3,001 views
Skip to first unread message

Vic Hargrave

unread,
Feb 15, 2003, 7:35:01 PM2/15/03
to
I'm trying to find the header file, if any, in which ETIMEDOUT is
defined for the pthread_cond_timedwait() function on Red Hat Linux 7.3
or other Linux distributions for that matter. I found a definition in
/usr/include/pi-source.h but that file does not appear to be included in
/usr/include/pthread.h. Does this mean that pthread_cond_timedwait() is
not defined for Linux distributions? Thanks in advance for info...

-- vic

Pete Becker

unread,
Feb 15, 2003, 7:38:45 PM2/15/03
to

<errno.h>

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)

Vic Hargrave

unread,
Feb 15, 2003, 8:31:42 PM2/15/03
to
Pete Becker wrote:
> Vic Hargrave wrote:
>
>>I'm trying to find the header file, if any, in which ETIMEDOUT is
>>defined for the pthread_cond_timedwait() function on Red Hat Linux 7.3
>>or other Linux distributions for that matter. I found a definition in
>>/usr/include/pi-source.h but that file does not appear to be included in
>>/usr/include/pthread.h. Does this mean that pthread_cond_timedwait() is
>>not defined for Linux distributions? Thanks in advance for info...
>>
>
>
> <errno.h>
>

Nope, not there...

Michael Fuhr

unread,
Feb 15, 2003, 11:25:09 PM2/15/03
to
Vic Hargrave <vhar...@attbi.com> writes:

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/

Pete Becker

unread,
Feb 16, 2003, 12:16:39 PM2/16/03
to

Yep, there...

Now say something useful, like how you determined that it's "not there."

Vic Hargrave

unread,
Feb 16, 2003, 7:04:04 PM2/16/03
to
Pete Becker wrote:

>
> Now say something useful, like how you determined that it's "not there."
>

grep ETIMEDOUT /usr/include/errno.h

-- vic

Michael Fuhr

unread,
Feb 16, 2003, 8:45:10 PM2/16/03
to
Vic Hargrave <vhar...@attbi.com> writes:

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?

Volodymyr Tarasenko

unread,
Feb 17, 2003, 5:38:48 AM2/17/03
to
Vic Hargrave <vhar...@attbi.com> wrote in message news:<V0B3a.127845$Ec4.1...@rwcrnsc52.ops.asp.att.net>...

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!

Pete Becker

unread,
Feb 17, 2003, 5:32:19 PM2/17/03
to

Try this instead:

#include <errno.h>

#ifdef ETIMEDOUT
#error found it
#else
#error not there
#endif

Vic Hargrave

unread,
Feb 18, 2003, 2:45:04 PM2/18/03
to
Michael Fuhr wrote:

> Vic Hargrave <vhar...@attbi.com> writes:
>
> 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?
>

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

Michael Fuhr

unread,
Feb 19, 2003, 12:33:07 AM2/19/03
to
Vic Hargrave <vhar...@attbi.com> writes:

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

xer...@gmail.com

unread,
Oct 26, 2016, 9:56:27 PM10/26/16
to
does it mean that I can define ETIMEDOUT to any value I want?

Casper H.S. Dik

unread,
Oct 27, 2016, 3:01:27 AM10/27/16
to
No, it only means that while you need to include <errno.h> to get a
definition of all error codes, it doesn't mean that these are
actually defined in /usr/include/errno.h; in my system they are
defined in /usr/include/sys/errno.h.

Casper
0 new messages