Skip site navigation (1) Skip section navigation (2)

Threading fix for AIX

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Zeugswetter Andreas DAZ SD <ZeugswetterA(at)spardat(dot)at>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>,Simon Riggs <simon(at)2ndquadrant(dot)com>,Andrew Sullivan <ajs(at)crankycanuck(dot)ca>,PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Threading fix for AIX
Date: 2004-12-14 12:48:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Zeugswetter Andreas DAZ SD wrote:
> >> However, one thing we can do is to try this in Makefile.aix:
> >> 	# AIX needs threads for everything that uses libpq
> >> That is going to enable thread libs for all linking including the
> >> backend, but it might work.
> > That is certainly wrong.  The correct thing is to add PTHREAD_LIBS to
> > all and only those links that include libpq.  I suspect that the cc_r
> You mean like attached patch ? That is safe and can be applied.
> My machine has problems with two configure tests with --enable-thread-safety.
> 1. the snprintf long long int check that uses int64 as variable name which is 
> 	a typedef in sys/inttypes.h

I changed it to ac_int64.  Does that help?

> 2. whether strerror_r returns int check fails with a redefine of named function 
> 	from string.h

I see.  Our test is:

	int strerror_r(int, char *, size_t);

but AIX is:

	int  strerror_r(int, char *, int);

OK, I added an #ifndef _AIX to use 'int' for the 3rd arg for AIX.

> No idea how to fix those, but workaround is easy :-(
> -lpthread can be removed from PTHREAD_LIBS, the lib is a compat symlink to 
> -lpthreads, I guess it does not hurt eighter. 

Yea, that is an effect of the tests we use and accumulate flags rather
than taking the first one that works.  The test tests compiling but
creating libraries that use threads actually needs more than one flag on
some platforms so we just take all flags we can.

It would be nice if your fix also helped unixware but that needs
compilere flags for any thread library usage and we don't have
centralized libpq-specific compiler flags like we have library flags.

Please test this patch and report back.  Thanks.

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2004-12-14 13:16:01
Subject: Re: rc1 packaged ...
Previous:From: strkDate: 2004-12-14 11:24:01
Subject: Re: join selectivity

pgsql-patches by date

Next:From: hyipDate: 2004-12-14 12:48:20
Subject: Re: Optional REFERENCES Feature in CREATE TRIGGER Command
Previous:From: Peter EisentrautDate: 2004-12-14 11:10:19
Subject: Re: small typo in create user --help

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group