Subject: Re: getpwent_r()
To: None <>
From: Christos Zoulas <>
List: current-users
Date: 04/01/2005 07:59:46
In article <>,
John Nemeth <> wrote:
>     libedit uses getpwent() to enumerate all users starting with a
>particular string.  I think this means that we are going to need a
>getpwent_r() function.  Solaris 8 has one that looks like this:
>     struct passwd *getpwent_r(struct passwd *pwd, char  *buffer,
>     int buflen);
>     For enumeration in multithreaded applications, the  position
>     within  the enumeration is a process-wide property shared by
>     all threads. The setpwent() function may be used in  a  mul-
>     tithreaded  application  but resets the enumeration position
>     for all threads.  If multiple threads  interleave  calls  to
>     getpwent_r(), the threads will enumerate disjoint subsets of
>     the password database.
>libedit also uses setpwent() and endpwent() which presents another
>problem.  I don't see any simple solutions to the enumeration position
>problem, so we'll probably just have to document that it does this.

Look at PR/298{49,50}.