cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: AIX multithreaded issue - CURLE_COULDNT_CONNECT

From: Alexander Krasnostavsky <ALEXANDERKR_at_Amdocs.com>
Date: Tue, 17 Aug 2004 13:45:19 +0300

You are right about the compiler, the -q option is fit for xlc (AIX
Compiler). The problem is when even with "-qthreaded" errno=0. Adding
_THREAD_SAFE solves the problem.
I also don't understand why "-qthreaded" is not doing the work.
errno is redefined per thread when _THREAD_SAFE is defined.
See the /usr/include/errno.h definition for errno bellow:

/*
 * Error codes
 *
 * The ANSI, POSIX, and XOPEN standards require that certain values
be
 * in errno.h. The standards allow additional macro definitions,
 * beginning with an E and an uppercase letter.
 *
 */

#ifdef _ANSI_C_SOURCE

#ifndef _KERNEL

#if defined(_THREAD_SAFE) || defined(_THREAD_SAFE_ERRNO)
/*
 * Per thread errno is provided by the threads provider. Both the extern
int
 * and the per thread value must be maintained by the threads library.
 */
extern int *_Errno( void );
#define errno (*_Errno())

#else

extern int errno;

#endif /* _THREAD_SAFE || _THREAD_SAFE_ERRNO */

#endif /* _KERNEL */

#ifdef _ALL_SOURCE

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Holger Rauch
Sent: Tuesday, August 17, 2004 12:17
To: libcurl development
Subject: Re: AIX multithreaded issue - CURLE_COULDNT_CONNECT

On Tue, 17 Aug 2004, Daniel Stenberg wrote:

> On Tue, 17 Aug 2004, Alexander Krasnostavsky wrote:
> [...]
> >I assume that -qthreaded also defined.
>
> I don't follow you. Is this a compiler options we should use on AIX?
(What
> does it do?) And then it would be only for a specific compiler, right?
If
> so, which?

Looks to me like it is the AIX C compiler from IBM. I remember they had
some
"-q" flags when I did my internship at IBM. It probably #defines some
thread-safe prototypes of functions that wouldn't otherwise be thread
safe
(I'm thinking of the _r functions, for example). Maybe specifying
"-qthreaded" also #defines _THREAD_SAFE or _REENTRANT behind the scenes.
Might be a good idea to specify "-qthreaded" when using the AIX C
compiler
(instead of just #defining _THREAD_SAFE), and specify either
_THREAD_SAFE or
_REENTRANT (or both, just to be sure) when using gcc on AIX.

What do other list members that are familiar with AIX think about this?

Kind regards,

        Holger

The information contained in this message is proprietary of Amdocs,
protected from disclosure, and may be privileged.
The information is intended to be conveyed only to the designated recipient(s)
of the message. If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, use, distribution or copying of
this communication is strictly prohibited and may be unlawful.
If you have received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.
Thank you.
Received on 2004-08-17