Patch for: 7.4.2 build broken on Solaris 7 and 8 with --enable-thread-safety

From: jseymour(at)LinxNet(dot)com (Jim Seymour)
To: pgsql-hackers(at)postgresql(dot)org
Subject: Patch for: 7.4.2 build broken on Solaris 7 and 8 with --enable-thread-safety
Date: 2004-03-14 20:06:59
Message-ID: 20040314200659.EEF444307@jimsun.LinxNet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi All,

The following patch fixes building PostgreSQL 7.4.2 under Sun (Sparc)
Solaris 7 and 8 (possibly earlier and later versions, as well) with
--enable-thread-safety.

The first addresses what would appear to be a coding error in
thread.c. The second ensures the proper pthread function call
semantics.

Build tested using GCC 3.3.1 under Solaris 7 and 8. Tested with
ancient version of Sun's commercial development package under Solaris
8.

Note: I don't know that --enable-thread-safety actually *works* on
these platforms. But the package now builds.

Regards,
Jim

*** ./src/port/thread.c-orig Tue Mar 2 13:38:28 2004
--- ./src/port/thread.c Sun Mar 14 10:07:04 2004
***************
*** 186,192 ****
* broken (well early POSIX draft) gethostbyname_r() which returns
* 'struct hostent *'
*/
! *result = gethostbyname_r(name, resbuf, buffer, buflen, herrno);
return (*result == NULL) ? -1 : 0;

#else
--- 186,192 ----
* broken (well early POSIX draft) gethostbyname_r() which returns
* 'struct hostent *'
*/
! *result = gethostbyname_r(name, resultbuf, buffer, buflen, herrno);
return (*result == NULL) ? -1 : 0;

#else
*** ./src/template/solaris-orig Wed Jan 7 23:21:20 2004
--- ./src/template/solaris Sun Mar 14 14:39:40 2004
***************
*** 12,19 ****
THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes # 5.6 2003-09-13
if test "$GCC" = yes
! then THREAD_LIBS="-pthread"
! else THREAD_CPPFLAGS="-mt"
THREAD_LIBS="-lpthread"
fi

--- 12,20 ----
THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes # 5.6 2003-09-13
if test "$GCC" = yes
! then THREAD_CPPFLAGS="-D_POSIX_PTHREAD_SEMANTICS"
! THREAD_LIBS="-pthread"
! else THREAD_CPPFLAGS="-mt -D_POSIX_PTHREAD_SEMANTICS"
THREAD_LIBS="-lpthread"
fi

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-03-14 20:42:31 Re: Log rotation
Previous Message Tom Lane 2004-03-14 19:22:01 Re: Log rotation