Re: [HACKERS] threads/UnixWare

2003-08-14 Thread Bruce Momjian

Actually, your getpwuid_r is the old, pre-POSIX format.  The attached
email has the configure tests.  I was hoping we wouldn't need them, but
it seems we may.

---

Larry Rosenman wrote:
 In src/port, we have in threads.c:
 
 /*
  * Wrapper around getpwuid() or getpwuid_r() to mimic POSIX getpwuid_r()
  * behaviour, if it is not available.
  */
 int
 pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
size_t buflen, struct passwd ** result)
 {
 #if defined(USE_THREADS)  defined(HAVE_GETPWUID_R)
 
 /*
  * broken (well early POSIX draft) getpwuid_r() which returns 
 'struct
  * passwd *'
  */
 *result = getpwuid_r(uid, resultbuf, buffer, buflen);
 #else
 /* no getpwuid_r() available, just use getpwuid() */
 *result = getpwuid(uid);
 #endif
 return (*result == NULL) ? -1 : 0;
 }
 
 
 Which BREAKS if you have the correct getpwuid_r() like UnixWare does.
 
 Can someone help me with the configure checks/macros I need?
 $ grep getpwuid_r /usr/include/pwd.h
 int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **);
 $
 
 
 
 
 -- 
 Larry Rosenman http://www.lerctr.org/~ler
 Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
 US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
 
 
 ---(end of broadcast)---
 TIP 8: explain analyze is your friend
 

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073
From [EMAIL PROTECTED] Tue Aug  5 06:13:10 2003
Return-path: [EMAIL PROTECTED]
Received: from internet.csl.co.uk (internet.csl.co.uk [194.130.52.3])
by candle.pha.pa.us (8.11.6/8.11.6) with ESMTP id h75AD8r29374
for [EMAIL PROTECTED]; Tue, 5 Aug 2003 06:13:09 -0400 (EDT)
Received: from euphrates.csl.co.uk (host-194-67.csl.co.uk [194.130.52.67])
by internet.csl.co.uk (8.12.8/8.12.8) with ESMTP id h75AD284032695;
Tue, 5 Aug 2003 11:13:02 +0100
Received: from kelvin.csl.co.uk by euphrates.csl.co.uk (8.9.3/ConceptI 2.4)
id LAA21628; Tue, 5 Aug 2003 11:13:00 +0100 (BST)
Received: from kelvin.csl.co.uk (localhost.localdomain [127.0.0.1])
by kelvin.csl.co.uk (8.12.8/8.12.8) with ESMTP id h75ACxU1028659;
Tue, 5 Aug 2003 11:12:59 +0100
Received: (from [EMAIL PROTECTED])
by kelvin.csl.co.uk (8.12.8/8.12.8/Submit) id h75ACsBW028655;
Tue, 5 Aug 2003 11:12:54 +0100
From: Lee Kindness [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: [EMAIL PROTECTED]
Date: Tue, 5 Aug 2003 11:12:54 +0100
To: Bruce Momjian [EMAIL PROTECTED]
Subject: --enable-thread-safety broken + patch regressions
X-Mailer: VM 7.07 under 21.4 (patch 12) Portable Code XEmacs Lucid
cc: Lee Kindness [EMAIL PROTECTED], [EMAIL PROTECTED]
Status: OR

Bruce, the changes you made yesterday to configure for
--enable-thread-safety have broken the build, at least for Linux on
Redhat 9.

Also, I took the opportunity to look at port/threads.c. It is missing
important functionality compaired to the patch I originally
submitted. For getpwuid_r, gethostbyname_r and strerror_r there are
three possible scenarios:

1. The OS doesn't have it (but the non _r function can still be thread
safe (i.e. HPUX 11)).

2. The OS has it, but the implmentation doesn't match the POSIX spec.

3. The OS has it, and the implmentation matches the POSIX spec.

Case 3 is not being considered. In my original patch this was handled
by the pqGetpwuid etc functions simply being defined to getpwuid_r
(except for pqStrerror).

I remember discussing with you that the implementation of pqStrerror
didn't really need the distinction between the two _r
versions. However I think the others do, and the native/correct _r
calls should be #defined in if they match the POSIX spec.

It's also worth considering that when the _r function is available AND
the normal function is also thread-safe then the _r version should
still be used since it has a clean API which removes unneeded locking
within the old function.

I've still got the latest (and earlier with some configure work)
patches I submitted up at:

 http://services.csl.co.uk/postgresql/

Thanks, Lee.


---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [HACKERS] threads/UnixWare

2003-08-14 Thread Larry Rosenman


--On Friday, August 08, 2003 02:10:25 -0400 Bruce Momjian 
[EMAIL PROTECTED] wrote:

Actually, your getpwuid_r is the old, pre-POSIX format.  The attached
email has the configure tests.  I was hoping we wouldn't need them, but
it seems we may.
Err, SCO claims SUSv2, the Single Unix Specification Version 2.  V3 
**JUST** came
out.

I'll look at Lee's stuff.





--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly


Re: [HACKERS] threads/UnixWare

2003-08-14 Thread Lee Kindness
Larry, haven't managed to look at that patch... But stuffed for time
just now - just about to head off for the weekend. I'm hoping to spend
a bit of time on this on Tuesday! So, i'll see how things have
progressed then.

L.

Larry Rosenman writes:
  --On Friday, August 08, 2003 11:53:34 +0100 Lee Kindness 
   I've not been keeping up with the thread re who has what version of
   getpwuid_r... But just to clarify things the right version is:
  
int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
   size_t bufsize, struct passwd **result);
  
   documented at:
  
http://www.opengroup.org/onlinepubs/007904975/functions/getpwuid.html
  
   My email to Bruce which he tacked onto his reply is a good summary of
   the current problems with the thread stuff.
  Ok.  Lee: Did you see the patch I posted?   Can you help on the configure 
  test(s)
  needed to set HAVE_POSIX_GETPWUID_R?
  
  I **THINK** I did the patch right to handle it if it's set.  I forced it 
  for UnixWare
  and it seems to work.
   Larry Rosenman writes:
 --On Friday, August 08, 2003 02:10:25 -0400 Bruce Momjian
 [EMAIL PROTECTED] wrote:
  Actually, your getpwuid_r is the old, pre-POSIX format.  The attached
  email has the configure tests.  I was hoping we wouldn't need them,
   butit seems we may.
 Err, SCO claims SUSv2, the Single Unix Specification Version 2.  V3
 **JUST** came
 out.

 I'll look at Lee's stuff.

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [HACKERS] threads/UnixWare

2003-08-11 Thread Bruce Momjian

Of course, I was wrong.  In fact, the patch below actually said it was
the pre-POSIX version of getpwuid_r().

---

Bruce Momjian wrote:
 
 Actually, your getpwuid_r is the old, pre-POSIX format.  The attached
 email has the configure tests.  I was hoping we wouldn't need them, but
 it seems we may.
 
 ---
 
 Larry Rosenman wrote:
  In src/port, we have in threads.c:
  
  /*
   * Wrapper around getpwuid() or getpwuid_r() to mimic POSIX getpwuid_r()
   * behaviour, if it is not available.
   */
  int
  pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
 size_t buflen, struct passwd ** result)
  {
  #if defined(USE_THREADS)  defined(HAVE_GETPWUID_R)
  
  /*
   * broken (well early POSIX draft) getpwuid_r() which returns 
  'struct
   * passwd *'
   */
  *result = getpwuid_r(uid, resultbuf, buffer, buflen);
  #else
  /* no getpwuid_r() available, just use getpwuid() */
  *result = getpwuid(uid);
  #endif
  return (*result == NULL) ? -1 : 0;
  }
  
  
  Which BREAKS if you have the correct getpwuid_r() like UnixWare does.
  
  Can someone help me with the configure checks/macros I need?
  $ grep getpwuid_r /usr/include/pwd.h
  int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **);
  $
  
  
  
  
  -- 
  Larry Rosenman http://www.lerctr.org/~ler
  Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
  US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
  
  
  ---(end of broadcast)---
  TIP 8: explain analyze is your friend
  
 
 -- 
   Bruce Momjian|  http://candle.pha.pa.us
   [EMAIL PROTECTED]   |  (610) 359-1001
   +  If your life is a hard drive, |  13 Roberts Road
   +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

 From [EMAIL PROTECTED] Tue Aug  5 06:13:10 2003
 Return-path: [EMAIL PROTECTED]
 Received: from internet.csl.co.uk (internet.csl.co.uk [194.130.52.3])
   by candle.pha.pa.us (8.11.6/8.11.6) with ESMTP id h75AD8r29374
   for [EMAIL PROTECTED]; Tue, 5 Aug 2003 06:13:09 -0400 (EDT)
 Received: from euphrates.csl.co.uk (host-194-67.csl.co.uk [194.130.52.67])
   by internet.csl.co.uk (8.12.8/8.12.8) with ESMTP id h75AD284032695;
   Tue, 5 Aug 2003 11:13:02 +0100
 Received: from kelvin.csl.co.uk by euphrates.csl.co.uk (8.9.3/ConceptI 2.4)
   id LAA21628; Tue, 5 Aug 2003 11:13:00 +0100 (BST)
 Received: from kelvin.csl.co.uk (localhost.localdomain [127.0.0.1])
   by kelvin.csl.co.uk (8.12.8/8.12.8) with ESMTP id h75ACxU1028659;
   Tue, 5 Aug 2003 11:12:59 +0100
 Received: (from [EMAIL PROTECTED])
   by kelvin.csl.co.uk (8.12.8/8.12.8/Submit) id h75ACsBW028655;
   Tue, 5 Aug 2003 11:12:54 +0100
 From: Lee Kindness [EMAIL PROTECTED]
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 Message-ID: [EMAIL PROTECTED]
 Date: Tue, 5 Aug 2003 11:12:54 +0100
 To: Bruce Momjian [EMAIL PROTECTED]
 Subject: --enable-thread-safety broken + patch regressions
 X-Mailer: VM 7.07 under 21.4 (patch 12) Portable Code XEmacs Lucid
 cc: Lee Kindness [EMAIL PROTECTED], [EMAIL PROTECTED]
 Status: OR
 
 Bruce, the changes you made yesterday to configure for
 --enable-thread-safety have broken the build, at least for Linux on
 Redhat 9.
 
 Also, I took the opportunity to look at port/threads.c. It is missing
 important functionality compaired to the patch I originally
 submitted. For getpwuid_r, gethostbyname_r and strerror_r there are
 three possible scenarios:
 
 1. The OS doesn't have it (but the non _r function can still be thread
 safe (i.e. HPUX 11)).
 
 2. The OS has it, but the implmentation doesn't match the POSIX spec.
 
 3. The OS has it, and the implmentation matches the POSIX spec.
 
 Case 3 is not being considered. In my original patch this was handled
 by the pqGetpwuid etc functions simply being defined to getpwuid_r
 (except for pqStrerror).
 
 I remember discussing with you that the implementation of pqStrerror
 didn't really need the distinction between the two _r
 versions. However I think the others do, and the native/correct _r
 calls should be #defined in if they match the POSIX spec.
 
 It's also worth considering that when the _r function is available AND
 the normal function is also thread-safe then the _r version should
 still be used since it has a clean API which removes unneeded locking
 within the old function.
 
 I've still got the latest (and earlier with some configure work)
 patches I submitted up at:
 
  http://services.csl.co.uk/postgresql/
 
 Thanks, Lee.
 

 
 ---(end of broadcast)---
 TIP 7: don't forget to increase your free space map settings

-- 
  

Re: [HACKERS] threads/UnixWare

2003-08-10 Thread Lee Kindness
I've not been keeping up with the thread re who has what version of
getpwuid_r... But just to clarify things the right version is:

 int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
size_t bufsize, struct passwd **result); 

documented at:

 http://www.opengroup.org/onlinepubs/007904975/functions/getpwuid.html

My email to Bruce which he tacked onto his reply is a good summary of
the current problems with the thread stuff.

L.

Larry Rosenman writes:
  
  
  --On Friday, August 08, 2003 02:10:25 -0400 Bruce Momjian 
  [EMAIL PROTECTED] wrote:
  
  
   Actually, your getpwuid_r is the old, pre-POSIX format.  The attached
   email has the configure tests.  I was hoping we wouldn't need them, but
   it seems we may.
  Err, SCO claims SUSv2, the Single Unix Specification Version 2.  V3 
  **JUST** came
  out.
  
  I'll look at Lee's stuff.
  
  
  
  
  
  -- 
  Larry Rosenman http://www.lerctr.org/~ler
  Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
  US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
  

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

   http://archives.postgresql.org


Re: [HACKERS] threads/UnixWare

2003-08-08 Thread Peter Eisentraut
Bruce Momjian writes:

 Actually, your getpwuid_r is the old, pre-POSIX format.

No, his is the right POSIX/SUS variant.

-- 
Peter Eisentraut   [EMAIL PROTECTED]

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [HACKERS] threads/UnixWare

2003-08-08 Thread Larry Rosenman


--On Friday, August 08, 2003 11:53:34 +0100 Lee Kindness 
[EMAIL PROTECTED] wrote:

I've not been keeping up with the thread re who has what version of
getpwuid_r... But just to clarify things the right version is:
 int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
size_t bufsize, struct passwd **result);
documented at:

 http://www.opengroup.org/onlinepubs/007904975/functions/getpwuid.html

My email to Bruce which he tacked onto his reply is a good summary of
the current problems with the thread stuff.
Ok.  Lee: Did you see the patch I posted?   Can you help on the configure 
test(s)
needed to set HAVE_POSIX_GETPWUID_R?

I **THINK** I did the patch right to handle it if it's set.  I forced it 
for UnixWare
and it seems to work.

LER

L.

Larry Rosenman writes:
 
 
  --On Friday, August 08, 2003 02:10:25 -0400 Bruce Momjian
  [EMAIL PROTECTED] wrote:
 
  
   Actually, your getpwuid_r is the old, pre-POSIX format.  The attached
   email has the configure tests.  I was hoping we wouldn't need them,
butit seems we may.
  Err, SCO claims SUSv2, the Single Unix Specification Version 2.  V3
  **JUST** came
  out.
 
  I'll look at Lee's stuff.
 
 
 
 
 
  --
  Larry Rosenman http://www.lerctr.org/~ler
  Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
  US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
 


--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
---(end of broadcast)---
TIP 8: explain analyze is your friend


[HACKERS] threads/UnixWare

2003-08-07 Thread Larry Rosenman
In src/port, we have in threads.c:

/*
* Wrapper around getpwuid() or getpwuid_r() to mimic POSIX getpwuid_r()
* behaviour, if it is not available.
*/
int
pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
  size_t buflen, struct passwd ** result)
{
#if defined(USE_THREADS)  defined(HAVE_GETPWUID_R)
   /*
* broken (well early POSIX draft) getpwuid_r() which returns 
'struct
* passwd *'
*/
   *result = getpwuid_r(uid, resultbuf, buffer, buflen);
#else
   /* no getpwuid_r() available, just use getpwuid() */
   *result = getpwuid(uid);
#endif
   return (*result == NULL) ? -1 : 0;
}

Which BREAKS if you have the correct getpwuid_r() like UnixWare does.

Can someone help me with the configure checks/macros I need?
$ grep getpwuid_r /usr/include/pwd.h
int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **);
$


--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
---(end of broadcast)---
TIP 8: explain analyze is your friend