This is the mail archive of the cygwin-patches@cygwin.com 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] |
Corinna, internal_getlogin() has evolved over time. Currently it has two purposes: 1) set Cygwin variables (e.g. cygheap->user, HOME, prgpsid,...) 2) set traditional Windows environment entries (e.g. HOMEPATH) It is called in 3 cases: a) Entry from Windows b) From seteuid() c) After CreateProcessAsUser() The purpose in cases a) and c) is 1 above. The purpose in case b) is mainly 2. I propose to reorganize the code by breaking internal_getlogin() in two functions, one that does 1) and another that does 2). The main purpose is to increase the efficiency, as explained below, as well as fixing some nits, e.g. LOGONSERVER is never updated. The first function would be called in cases a) and c), although it would do very little in case c). The second one would be called in spawn_guts(), just before the CreateProcessAsUser() [when the environment is copied to the cygheap]. There would be no call to internal_getlogin() from seteuid(). The few Cygwin fields that need updating in seteuid() [e.g.user.name] would be handled in seteuid() itself, where the info is readily available. These changes would improve the performances of servers [such as mail servers] that setuid() repeatedly but exec() only rarely, in particular avoiding lookups over the network. As a first step in this process, the attached patches contain the modifications that add function 2). They can already be applied although internal_getlogin() is not touched. It will be simplified in a second phase. This will allow you to more easily check what's going on. I worry (because I can't test) that this might break applications using sexecXX calls, although I don't see how it would. Are there any still around? It would be easy to bypass the new code for sexecXX calls, if needed. 2002-06-09 Pierre Humblet <pierre.humblet@ieee.org> * environ.cc (addWinDefEnv): New. (inWinDefEnv): New. (writeWinDefEnv): New. * spawn.cc (spawn_guts): Call functions above to set traditional Windows environment variables when copying the environment to the cygheap, before CreateProcessAsUser(). Define sec_attribs and call sec_user_nih() only once. * environ.h: Declare inWinDefEnv() and addWinDefEnv(), and define WINDEFENVC. Pierre
Attachment:
spawn.cc.diff
Description: Text document
Attachment:
environ.h.diff
Description: Text document
Attachment:
environ.cc.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |