aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-11-17 17:28:35 +0000
committerRichard M. Stallman1994-11-17 17:28:35 +0000
commit7b92975ff2538e28da006f17211a7f3b41880df8 (patch)
tree1f78df2d8191cdc3d5741bca6d2542faa9f157a8 /src
parentdc554c3acc16e3aa7435c018a23a3a94bf50902e (diff)
downloademacs-7b92975ff2538e28da006f17211a7f3b41880df8.tar.gz
emacs-7b92975ff2538e28da006f17211a7f3b41880df8.zip
(lock_dir, superlock_file, MAKE_LOCK_NAME):
Renamed from lock_path, superlock_path, MAKE_LOCK_PATH.
Diffstat (limited to 'src')
-rw-r--r--src/filelock.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/filelock.c b/src/filelock.c
index f7e21576678..24c1c26bf59 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -77,23 +77,23 @@ extern struct passwd *getpwuid ();
77 77
78/* The name of the directory in which we keep lock files, with a '/' 78/* The name of the directory in which we keep lock files, with a '/'
79 appended. */ 79 appended. */
80char *lock_path; 80char *lock_dir;
81 81
82/* The name of the file in the lock directory which is used to 82/* The name of the file in the lock directory which is used to
83 arbitrate access to the entire directory. */ 83 arbitrate access to the entire directory. */
84#define SUPERLOCK_NAME "!!!SuperLock!!!" 84#define SUPERLOCK_NAME "!!!SuperLock!!!"
85 85
86/* The path to the superlock file. This is SUPERLOCK_NAME appended to 86/* The name of the superlock file. This is SUPERLOCK_NAME appended to
87 lock_path. */ 87 lock_dir. */
88char *superlock_path; 88char *superlock_file;
89 89
90/* Set LOCK to the name of the lock file for the filename FILE. 90/* Set LOCK to the name of the lock file for the filename FILE.
91 char *LOCK; Lisp_Object FILE; */ 91 char *LOCK; Lisp_Object FILE; */
92 92
93#ifndef HAVE_LONG_FILE_NAMES 93#ifndef HAVE_LONG_FILE_NAMES
94 94
95#define MAKE_LOCK_PATH(lock, file) \ 95#define MAKE_LOCK_NAME(lock, file) \
96 (lock = (char *) alloca (14 + strlen (lock_path) + 1), \ 96 (lock = (char *) alloca (14 + strlen (lock_dir) + 1), \
97 fill_in_lock_short_file_name (lock, (file))) 97 fill_in_lock_short_file_name (lock, (file)))
98 98
99 99
@@ -124,15 +124,15 @@ fill_in_lock_short_file_name (lockfile, fn)
124 crc.byte[1] = crc.byte[0]; 124 crc.byte[1] = crc.byte[0];
125 crc.byte[0] = new; 125 crc.byte[0] = new;
126 } 126 }
127 sprintf (lockfile, "%s%.2x%.2x%.2x%.2x%.2x%.2x%.2x", lock_path, 127 sprintf (lockfile, "%s%.2x%.2x%.2x%.2x%.2x%.2x%.2x", lock_dir,
128 crc.byte[0], crc.byte[1], crc.byte[2], crc.byte[3], 128 crc.byte[0], crc.byte[1], crc.byte[2], crc.byte[3],
129 crc.byte[4], crc.byte[5], crc.byte[6]); 129 crc.byte[4], crc.byte[5], crc.byte[6]);
130} 130}
131 131
132#else /* defined HAVE_LONG_FILE_NAMES */ 132#else /* defined HAVE_LONG_FILE_NAMES */
133 133
134#define MAKE_LOCK_PATH(lock, file) \ 134#define MAKE_LOCK_NAME(lock, file) \
135 (lock = (char *) alloca (XSTRING (file)->size + strlen (lock_path) + 1), \ 135 (lock = (char *) alloca (XSTRING (file)->size + strlen (lock_dir) + 1), \
136 fill_in_lock_file_name (lock, (file))) 136 fill_in_lock_file_name (lock, (file)))
137 137
138 138
@@ -142,7 +142,7 @@ fill_in_lock_file_name (lockfile, fn)
142{ 142{
143 register char *p; 143 register char *p;
144 144
145 strcpy (lockfile, lock_path); 145 strcpy (lockfile, lock_dir);
146 146
147 p = lockfile + strlen (lockfile); 147 p = lockfile + strlen (lockfile);
148 148
@@ -202,7 +202,7 @@ lock_file (fn)
202 register Lisp_Object attack; 202 register Lisp_Object attack;
203 register char *lfname; 203 register char *lfname;
204 204
205 MAKE_LOCK_PATH (lfname, fn); 205 MAKE_LOCK_NAME (lfname, fn);
206 206
207 /* See if this file is visited and has changed on disk since it was 207 /* See if this file is visited and has changed on disk since it was
208 visited. */ 208 visited. */
@@ -228,7 +228,7 @@ lock_file (fn)
228 { 228 {
229 lock_superlock (lfname); 229 lock_superlock (lfname);
230 lock_file_1 (lfname, O_WRONLY) ; 230 lock_file_1 (lfname, O_WRONLY) ;
231 unlink (superlock_path); 231 unlink (superlock_file);
232 return; 232 return;
233 } 233 }
234 /* User says ignore the lock */ 234 /* User says ignore the lock */
@@ -329,14 +329,14 @@ unlock_file (fn)
329{ 329{
330 register char *lfname; 330 register char *lfname;
331 331
332 MAKE_LOCK_PATH (lfname, fn); 332 MAKE_LOCK_NAME (lfname, fn);
333 333
334 lock_superlock (lfname); 334 lock_superlock (lfname);
335 335
336 if (current_lock_owner_1 (lfname) == getpid ()) 336 if (current_lock_owner_1 (lfname) == getpid ())
337 unlink (lfname); 337 unlink (lfname);
338 338
339 unlink (superlock_path); 339 unlink (superlock_file);
340} 340}
341 341
342lock_superlock (lfname) 342lock_superlock (lfname)
@@ -345,7 +345,7 @@ lock_superlock (lfname)
345 register int i, fd; 345 register int i, fd;
346 DIR *lockdir; 346 DIR *lockdir;
347 347
348 for (i = -20; i < 0 && (fd = open (superlock_path, 348 for (i = -20; i < 0 && (fd = open (superlock_file,
349 O_WRONLY | O_EXCL | O_CREAT, 0666)) < 0; 349 O_WRONLY | O_EXCL | O_CREAT, 0666)) < 0;
350 i++) 350 i++)
351 { 351 {
@@ -355,7 +355,7 @@ lock_superlock (lfname)
355 /* This seems to be necessary to prevent Emacs from hanging when the 355 /* This seems to be necessary to prevent Emacs from hanging when the
356 competing process has already deleted the superlock, but it's still 356 competing process has already deleted the superlock, but it's still
357 in the NFS cache. So we force NFS to synchronize the cache. */ 357 in the NFS cache. So we force NFS to synchronize the cache. */
358 if (lockdir = opendir (lock_path)) 358 if (lockdir = opendir (lock_dir))
359 closedir (lockdir); 359 closedir (lockdir);
360 360
361 sleep (1); 361 sleep (1);
@@ -363,7 +363,7 @@ lock_superlock (lfname)
363 if (fd >= 0) 363 if (fd >= 0)
364 { 364 {
365#ifdef USG 365#ifdef USG
366 chmod (superlock_path, 0666); 366 chmod (superlock_file, 0666);
367#else 367#else
368 fchmod (fd, 0666); 368 fchmod (fd, 0666);
369#endif 369#endif
@@ -439,7 +439,7 @@ t if it is locked by you, else a string of the name of the locker.")
439 439
440 fn = Fexpand_file_name (fn, Qnil); 440 fn = Fexpand_file_name (fn, Qnil);
441 441
442 MAKE_LOCK_PATH (lfname, fn); 442 MAKE_LOCK_NAME (lfname, fn);
443 443
444 owner = current_lock_owner (lfname); 444 owner = current_lock_owner (lfname);
445 if (owner <= 0) 445 if (owner <= 0)
@@ -455,25 +455,25 @@ t if it is locked by you, else a string of the name of the locker.")
455 455
456init_filelock () 456init_filelock ()
457{ 457{
458 char *new_path 458 char *new_name
459 459
460 lock_path = egetenv ("EMACSLOCKDIR"); 460 lock_dir = egetenv ("EMACSLOCKDIR");
461 if (! lock_path) 461 if (! lock_dir)
462 lock_path = PATH_LOCK; 462 lock_dir = PATH_LOCK;
463 463
464 /* Copy the path in case egetenv got it from a Lisp string. */ 464 /* Copy the name in case egetenv got it from a Lisp string. */
465 new_path = (char *) xmalloc (strlen (lock_path) + 2); 465 new_name = (char *) xmalloc (strlen (lock_dir) + 2);
466 strcpy (new_path, lock_path); 466 strcpy (new_name, lock_dir);
467 lock_path = new_path; 467 lock_dir = new_name;
468 468
469 /* Make sure it ends with a slash. */ 469 /* Make sure it ends with a slash. */
470 if (lock_path[strlen (lock_path) - 1] != '/') 470 if (lock_dir[strlen (lock_dir) - 1] != '/')
471 strcat (lock_path, "/"); 471 strcat (lock_dir, "/");
472 472
473 superlock_path = (char *) xmalloc ((strlen (lock_path) 473 superlock_file = (char *) xmalloc ((strlen (lock_dir)
474 + sizeof (SUPERLOCK_NAME))); 474 + sizeof (SUPERLOCK_NAME)));
475 strcpy (superlock_path, lock_path); 475 strcpy (superlock_file, lock_dir);
476 strcat (superlock_path, SUPERLOCK_NAME); 476 strcat (superlock_file, SUPERLOCK_NAME);
477} 477}
478 478
479syms_of_filelock () 479syms_of_filelock ()