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
  

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to