This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Avoiding /etc/passwd and /etc/group scans

Christopher Faylor wrote:
> On Mon, Oct 21, 2002 at 11:01:59AM -0400, Pierre A. Humblet wrote:
> >Cygwin scans the passwd and group files to map sids
> >to/from uid & gid. It does so even for the current user,
> >although the relevant mappings are stored internally.
> >This is inefficient and causes problems (e.g. gcc produces
> >non executable files) as soon as /etc/passwd is incomplete.
> It's only supposed to be doing this for the first cygwin process that
> start up on a given console.  Is that, again, no longer the case?  

What is "doing this"? Cygwin initially reads the files into memory.
No change there.
Currently, each time it gets/sets a file mode, it scans the internal
copies of passwd and group to map gid to/from sid and to map uid 
to/from sid. It is already optimized to avoid the uid scan when the 
file uid is that of the current user.

The patch extends the optimization to the 3 other mappings (gid->sid,
sid->uid, sid->gid) for the current user (the most common case). 
As a positive side effect, Cygwin then behaves well even when the user 
sid is not present in passwd (a common occurrence, judging from the
"gcc produces non executable .exe" traffic on the cygwin list).

> It seems like we keep drifting here.  We shouldn't be incurring the
> /etc/group and /etc/passwd startup costs even when ntsec isn't
> available.
No change at all in startup.
The files are read once, with or without ntsec, to find the user uid/gid
from the sid (if the sid is present) or from the user name.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]