1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-19 10:22:27 +00:00
emacs/nt/inc
Paul Eggert 707431575a FILE's lock is now always .#FILE and may be a regular file.
* etc/NEWS: Document this.
* nt/inc/unistd.h (O_NOFOLLOW): New macro.
* src/filelock.c: Include <c-ctype.h>.
(MAX_LFINFO): New top-level constant.
(lock_info_type): Remove members pid, boot_time.  Add members at,
dot, colon.  Change user member to be the entire buffer, not a
pointer.  This allows us to handle the case where a foreign
pid or boot time exceeds the local range.  All uses changed.
(LINKS_MIGHT_NOT_WORK): New constant.
(FREE_LOCK_INFO): Remove, as the pieces no longer need freeing.
(defined_WINDOWSNT): Remove.
(MAKE_LOCK_NAME, file_in_lock_file_name):
Always use .#FILE (not .#-FILE) for the file lock,
even if it is a regular file.
(rename_lock_file): New function.
(create_lock_file): Use it.
(create_lock_file, read_lock_data):
Prefer a symbolic link for the lock file, falling back on a
regular file if symlinks don't work.  Do not try to create
symlinks on MS-Windows, due to security hassles.  Stick with
POSIXish functions (open, read, write, close, fchmod, readlink, symlink,
link, rename, unlink, mkstemp) when creating locks, as a GNUish
host may be using a Windowsish file system, and cannot use
MS-Windows-only system calls.  Fall back on mktemp if mkstemp
doesn't work.  Don't fail merely because of a symlink-contents
length limit in the current file system; fall back on regular
files.  Increase the symlink contents length limit to 8 KiB, this
should be big enough for any real use and doesn't crunch the
stack.
(create_lock_file, lock_file_1, read_lock_data):
Simplify allocation of lock file buffers now that they fit in 8 KiB.
(lock_file_1): Return error number, not bool.  All callers changed.
(ELOOP): New macro, if not already defined.
(read_lock_data): Return size of lock file contents, not Lisp object.
All callers changed.  Handle a race condition if some other process
replaces a regular-file lock with a symlink lock or vice versa,
while we're trying to read the lock.
(current_lock_owner): Parse contents more carefully, to help avoid
confusing a regular-file lock with some other application's use
of the file.  Check for lock file contents being too long, or
not parsing correctly.
(current_lock_owner, lock_file):
Allow foreign pid and boot times that exceed the local range.
(current_lock_owner, lock_if_free, lock_file):
Simplify allocation of lock file contents.
* src/w32.c (sys_rename_replace): New function, containing most of
the contents of the old sys_rename.
(sys_rename): Use it.
(fchmod): New dummy function.
* src/w32.h (sys_rename_replace, fchmod): New decls.

Fixes: debbugs:13807
2013-03-05 14:35:41 -08:00
..
arpa Nuke arch-tags. 2011-01-15 15:16:57 -08:00
netinet Nuke arch-tags. 2011-01-15 15:16:57 -08:00
sys Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
dirent.h Make opendir on MS-Windows accept a 'const char *'. 2013-01-28 16:41:08 +02:00
grp.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
inttypes.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
langinfo.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
ms-w32.h Implement CLASH_DETECTION for MS-Windows. 2013-02-25 19:36:03 +02:00
netdb.h Nuke arch-tags. 2011-01-15 15:16:57 -08:00
nl_types.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
pwd.h Fix warnings when compiling on MS-Windows with -std=gnu99. 2012-10-17 21:02:44 +02:00
stdalign.h MS-Windows followup for 2012-07-28T23:05:32Z!eggert@cs.ucla.edu. 2012-07-29 18:43:09 +03:00
stdbool.h Fix the MS-Windows build broken by 2011-01-30T23:34:18Z!eggert@cs.ucla.edu and 2011-01-31T08:15:13Z!eggert@cs.ucla.edu. 2011-01-31 21:36:08 +02:00
stdint.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
unistd.h FILE's lock is now always .#FILE and may be a regular file. 2013-03-05 14:35:41 -08:00