LibC status and others...

Dave Leimbach leimySPAM2k at mac.com
Wed Dec 10 16:29:47 PST 2003


Dave Leimbach <leimySPAM2k at xxxxxxx> writes:

> Matthew Dillon <dillon at xxxxxxxxxxxxxxxxxxxx> writes:
> 
> 
> >     We aren't going to be using NSS in that way... we will be using IPC
> >     services for such lookups.  But if you need a getpwnam_r() it should
> >     be possible to adapt the existing getpwnam() (and other functions) in
> >     /usr/src/lib/libc/gen/getpwent.c.
> > 
> >     What I would do is rename, e.g., getpwnam() to getpwnam_r(), add the
> >     required passwd pointer, and use the pointer instead of the static 
> >     _pw_passwd.  Then write a new getpwnam() which simply aclls
> >     getpwnam_r() using &_pw_passwd for the passwd pointer.
> 
> It is not implemented the way you think I fear :).  There are no static data
> members in getpwnam...  Some other internal function keeps the static data.
> 

Its actually very different.  The re-entrant form takes a lot more
parameters and returns an int I believe.

int 
getpwnam_r(const char *, struct passwd *, char *, size_t, struct
passwd **);

vs 

struct passwd * 
getpwnam(const char *);


Dave





More information about the Kernel mailing list