diff options
| author | Eli Zaretskii | 2013-02-25 19:36:03 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-02-25 19:36:03 +0200 |
| commit | 343a2aefb528ce3c978ba2145705b9e37bfbe02a (patch) | |
| tree | 4672030eea98dfc9bd077ac58400271d1c812918 /nt | |
| parent | aec32f66d0db82b562e904dfe7bb6d54796fe773 (diff) | |
| download | emacs-343a2aefb528ce3c978ba2145705b9e37bfbe02a.tar.gz emacs-343a2aefb528ce3c978ba2145705b9e37bfbe02a.zip | |
Implement CLASH_DETECTION for MS-Windows.
src/filelock.c [WINDOWSNT]: Include w32.h.
(MAKE_LOCK_NAME): Don't use 'lock', it clashes with MS runtime
function of that name. Up-case the macro arguments.
(IS_LOCK_FILE): New macro.
(fill_in_lock_file_name): Use IS_LOCK_FILE instead of S_ISLNK.
(create_lock_file): New function, with body extracted from
lock_file_1.
[WINDOWSNT]: Implement lock files by writing a regular file with
the lock information as its contents.
(read_lock_data): New function, on Posix platforms just calls
emacs_readlinkat.
[WINDOWSNT]: Read the lock info from the file.
(current_lock_owner): Call read_lock_data instead of calling
emacs_readlinkat directly.
(lock_file) [WINDOWSNT]: Run the file name through
dostounix_filename.
src/w32proc.c (sys_kill): Support the case of SIG = 0, in which case
just check if the process by that PID exists.
src/w32.c (sys_open): Don't reset the _O_CREAT flag if _O_EXCL is
also present, as doing so will fail to error out if the file
already exists.
src/makefile.w32-in ($(BLD)/filelock.$(O)): Depend on src/w32.h.
nt/inc/ms-w32.h (BOOT_TIME_FILE): Define.
nt/config.nt (CLASH_DETECTION): Define to 1.
lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): Reject files
that match "\`\.#", to avoid compiling lock files, even if they
are readable (as they are on MS-Windows).
doc/emacs/files.texi (Interlocking): Don't refer to symlinks as the
exclusive means of locking files.
etc/NEWS: Mention support for lock files on MS-Windows.
Diffstat (limited to 'nt')
| -rw-r--r-- | nt/ChangeLog | 6 | ||||
| -rw-r--r-- | nt/config.nt | 2 | ||||
| -rw-r--r-- | nt/inc/ms-w32.h | 12 |
3 files changed, 19 insertions, 1 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog index a8bb8c74c91..fab143fcddc 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-02-25 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * inc/ms-w32.h (BOOT_TIME_FILE): Define. | ||
| 4 | |||
| 5 | * config.nt (CLASH_DETECTION): Define to 1. | ||
| 6 | |||
| 1 | 2013-02-16 Eli Zaretskii <eliz@gnu.org> | 7 | 2013-02-16 Eli Zaretskii <eliz@gnu.org> |
| 2 | 8 | ||
| 3 | * inc/ms-w32.h (__STDC__): Fiddle with value only for MSVC. | 9 | * inc/ms-w32.h (__STDC__): Fiddle with value only for MSVC. |
diff --git a/nt/config.nt b/nt/config.nt index 61e56174bb4..cc4e91d9af0 100644 --- a/nt/config.nt +++ b/nt/config.nt | |||
| @@ -75,7 +75,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 75 | /* Define if you want lock files to be written, so that Emacs can tell | 75 | /* Define if you want lock files to be written, so that Emacs can tell |
| 76 | instantly when you try to modify a file that someone else has modified in | 76 | instantly when you try to modify a file that someone else has modified in |
| 77 | his/her Emacs. */ | 77 | his/her Emacs. */ |
| 78 | #undef CLASH_DETECTION | 78 | #define CLASH_DETECTION 1 |
| 79 | 79 | ||
| 80 | /* Short copyright string for this version of Emacs. */ | 80 | /* Short copyright string for this version of Emacs. */ |
| 81 | #define COPYRIGHT "Copyright (C) 2013 Free Software Foundation, Inc." | 81 | #define COPYRIGHT "Copyright (C) 2013 Free Software Foundation, Inc." |
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 66f586a4f76..9473fbe3ca6 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h | |||
| @@ -70,6 +70,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 70 | #define HAVE___BUILTIN_UNWIND_INIT 1 | 70 | #define HAVE___BUILTIN_UNWIND_INIT 1 |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | /* This isn't perfect, as some systems might have the page file in | ||
| 74 | another place. Also, I suspect that the time stamp of that file | ||
| 75 | might also change when Windows enlarges the file due to | ||
| 76 | insufficient VM. Still, this seems to be the most reliable way; | ||
| 77 | the alternative (of using GetSystemTimes) won't work on laptops | ||
| 78 | that hibernate, because the system clock is stopped then. Other | ||
| 79 | possibility would be to run "net statistics workstation" and parse | ||
| 80 | the output, but that's gross. So this should do; if the file is | ||
| 81 | not there, the boot time will be returned as zero, and filelock.c | ||
| 82 | already handles that. */ | ||
| 83 | #define BOOT_TIME_FILE "C:/pagefile.sys" | ||
| 84 | |||
| 73 | /* ============================================================ */ | 85 | /* ============================================================ */ |
| 74 | 86 | ||
| 75 | /* Here, add any special hacks needed to make Emacs work on this | 87 | /* Here, add any special hacks needed to make Emacs work on this |