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] |
At 10:26 AM 12/2/2003 +0100, Corinna Vinschen wrote: >On Mon, Dec 01, 2003 at 10:55:46PM -0500, Pierre A. Humblet wrote: >> Also, the utmp/wtmp functions use mutexes to insure safe access. >> That creates two problems, particularly on servers: >> - When users have private copies of Cygwin with different mounts, >> there can be several utmp/wtmp files. Having a global mutex isn't >> helpful. >> - If the utmp/wtmp files are unique, a user may not be have the >> privilege to create a global mutex, so that no mutual protection >> is achieved. >> Both problems could be solved very simply by using file locking. >> Should I do that some day? > >Sure, go ahead. Here it is. In the case of wtmp, records are always appended. A new function, "locked_append", avoids collisions. In the case of utmp, if an entry for a tty already exists, it is modified by the login/logout processes. There is only one such process per tty, thus no locking is required. If there is no entry for the tty, a new one is safely created with the same "locked_append" function. Because the lock is mandatory, reads of locked regions will fail. The current code already handles that. Pierre 2003-12-05 Pierre Humblet <pierre.humblet@ieee.org> * syscalls.cc (locked_append): New. (updwtmp): Remove mutex code and call locked_append. (pututline): Ditto.
Attachment:
syscalls.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] |