summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in3
-rw-r--r--src/alloc.c5
-rw-r--r--src/callproc.c20
-rw-r--r--src/data.c6
-rw-r--r--src/emacs.c3
-rw-r--r--src/filelock.c108
-rw-r--r--src/floatfns.c6
-rw-r--r--src/keyboard.c5
-rw-r--r--src/process.c48
-rw-r--r--src/s/aix3-1.h2
-rw-r--r--src/syntax.c13
-rw-r--r--src/sysdep.c12
-rw-r--r--src/syssignal.h73
13 files changed, 208 insertions, 96 deletions
diff --git a/Makefile.in b/Makefile.in
index ceb8f0e8297..13c3ed38263 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -127,8 +127,7 @@ src/paths.h: Makefile src/paths.h.in
-e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "'$${buildlisppath}'";' \
-e 's;\(#.*PATH_EXEC\).*$$;\1 "${libdir}";' \
-e 's;\(#.*PATH_DATA\).*$$;\1 "${datadir}";' \
- -e 's;\(#.*PATH_LOCK\).*$$;\1 "${lockdir}/";' \
- -e 's;\(#.*PATH_SUPERLOCK\).*$$;\1 "${lockdir}/!!!SuperLock!!!";'
+ -e 's;\(#.*PATH_LOCK\).*$$;\1 "${lockdir}/";'
src: lib-src
diff --git a/src/alloc.c b/src/alloc.c
index 3f40ea47e50..b4637970dd7 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -551,8 +551,9 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
register struct Lisp_Marker *p;
/* Detact the bug that seems to have caused this to be called from
a signal handler. */
- int mask = sigsetmask (-1);
- sigsetmask (mask);
+ int mask, dummy;
+ EMACS_SIGSETMASK (-1, mask);
+ EMACS_SIGSETMASK (mask, dummy);
if (mask != 0)
abort ();
diff --git a/src/callproc.c b/src/callproc.c
index 68b447d401d..1a564ad7ccc 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -224,7 +224,11 @@ If you quit, the process is killed with SIGKILL.")
/* Tell SIGCHLD handler to look for this pid. */
synch_process_pid = pid;
/* Now let SIGCHLD come through. */
- sigsetmask (mask);
+ {
+ int dummy;
+
+ EMACS_SIGSETMASK (mask, dummy);
+ }
#endif
environ = save_environ;
@@ -530,11 +534,17 @@ init_callproc ()
register char **envp;
Lisp_Object tempdir;
- Vdata_directory = Ffile_name_as_directory (build_string (PATH_DATA));
+ {
+ char *data_dir = egetenv ("EMACSDATA");
+
+ Vdata_directory =
+ Ffile_name_as_directory
+ (build_string (data_dir ? data_dir : PATH_DATA));
+ }
- /* Turn PATH_EXEC into a path. `==' is just a string which we know
- will not be the name of an environment variable. */
- Vexec_path = decode_env_path ("==", PATH_EXEC);
+ /* Check the EMACSPATH environment variable, defaulting to the
+ PATH_EXEC path from paths.h. */
+ Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC);
Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
diff --git a/src/data.c b/src/data.c
index 4e95494d593..48af4ec9149 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1959,7 +1959,11 @@ arith_error (signo)
#ifdef BSD4_1
sigrelse (SIGFPE);
#else /* not BSD4_1 */
- sigsetmask (SIGEMPTYMASK);
+ {
+ int dummy;
+
+ EMACS_SIGSETMASK (SIGEMPTYMASK, dummy);
+ }
#endif /* not BSD4_1 */
Fsignal (Qarith_error, Qnil);
diff --git a/src/emacs.c b/src/emacs.c
index c530eca103f..90a86b26723 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -442,6 +442,9 @@ main (argc, argv, envp)
init_vmsfns ();
#endif /* VMS */
init_process ();
+#ifdef CLASH_DETECTION
+ init_filelock ();
+#endif /* CLASH_DETECTION */
/* Intern the names of all standard functions and variables; define standard keys */
diff --git a/src/filelock.c b/src/filelock.c
index a2c7941fced..7a473753e58 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -1,10 +1,10 @@
-/* Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
+/* Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
@@ -39,6 +39,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
extern int errno;
+extern char *egetenv ();
+
#ifdef CLASH_DETECTION
/* If system does not have symbolic links, it does not have lstat.
@@ -48,6 +50,44 @@ extern int errno;
#define lstat stat
#endif
+
+/* The name of the directory in which we keep lock files, with a '/'
+ appended. */
+char *lock_path;
+
+/* The name of the file in the lock directory which is used to
+ arbitrate access to the entire directory. */
+#define SUPERLOCK_NAME "!!!SuperLock!!!"
+
+/* The path to the superlock file. This is SUPERLOCK_NAME appended to
+ lock_path. */
+char *superlock_path;
+
+/* Set LOCK to the name of the lock file for the filename FILE.
+ char *LOCK; Lisp_Object FILE; */
+#define MAKE_LOCK_PATH (lock, file) \
+ (lock = (char *) alloca (XSTRING (file)->size + strlen (lock_path) + 1), \
+ fill_in_lock_file_name (lock, (file)))
+
+fill_in_lock_file_name (lockfile, fn)
+ register char *lockfile;
+ register Lisp_Object fn;
+{
+ register char *p;
+
+ strcpy (lockfile, lock_path);
+
+ p = lockfile + strlen (lockfile);
+
+ strcpy (p, XSTRING (fn)->data);
+
+ for (; *p; p++)
+ {
+ if (*p == '/')
+ *p = '!';
+ }
+}
+
static Lisp_Object
lock_file_owner_name (lfname)
char *lfname;
@@ -90,11 +130,10 @@ lock_file (fn)
register Lisp_Object attack;
register char *lfname;
- /* Create the name of the lock-file for file fn */
- lfname = (char *) alloca (XSTRING (fn)->size + strlen (PATH_LOCK) + 1);
- fill_in_lock_file_name (lfname, fn);
+ MAKE_LOCK_PATH (lfname, fn);
- /* See if this file is visited and has changed on disk since it was visited. */
+ /* See if this file is visited and has changed on disk since it was
+ visited. */
{
register Lisp_Object subject_buf = Fget_file_buffer (fn);
if (!NILP (subject_buf)
@@ -116,31 +155,12 @@ lock_file (fn)
{
lock_superlock (lfname);
lock_file_1 (lfname, O_WRONLY) ;
- unlink (PATH_SUPERLOCK);
+ unlink (superlock_path);
return;
}
/* User says ignore the lock */
}
-fill_in_lock_file_name (lockfile, fn)
- register char *lockfile;
- register Lisp_Object fn;
-{
- register char *p;
-
- strcpy (lockfile, PATH_LOCK);
-
- p = lockfile + strlen (lockfile);
-
- strcpy (p, XSTRING (fn)->data);
-
- for (; *p; p++)
- {
- if (*p == '/')
- *p = '!';
- }
-}
-
/* Lock the lock file named LFNAME.
If MODE is O_WRONLY, we do so even if it is already locked.
If MODE is O_WRONLY | O_EXCL | O_CREAT, we do so only if it is free.
@@ -236,15 +256,14 @@ unlock_file (fn)
{
register char *lfname;
- lfname = (char *) alloca (XSTRING (fn)->size + strlen (PATH_LOCK) + 1);
- fill_in_lock_file_name (lfname, fn);
+ MAKE_LOCK_PATH (lfname, fn);
lock_superlock (lfname);
if (current_lock_owner_1 (lfname) == getpid ())
unlink (lfname);
- unlink (PATH_SUPERLOCK);
+ unlink (superlock_path);
}
lock_superlock (lfname)
@@ -252,7 +271,7 @@ lock_superlock (lfname)
{
register int i, fd;
- for (i = -20; i < 0 && (fd = open (PATH_SUPERLOCK,
+ for (i = -20; i < 0 && (fd = open (superlock_path,
O_WRONLY | O_EXCL | O_CREAT, 0666)) < 0;
i++)
{
@@ -263,7 +282,7 @@ lock_superlock (lfname)
if (fd >= 0)
{
#ifdef USG
- chmod (PATH_SUPERLOCK, 0666);
+ chmod (superlock_path, 0666);
#else
fchmod (fd, 0666);
#endif
@@ -341,9 +360,7 @@ t if it is locked by you, else a string of the name of the locker.")
fn = Fexpand_file_name (fn, Qnil);
- /* Create the name of the lock-file for file filename */
- lfname = (char *) alloca (XSTRING (fn)->size + strlen (PATH_LOCK) + 1);
- fill_in_lock_file_name (lfname, fn);
+ MAKE_LOCK_PATH (lfname, fn);
owner = current_lock_owner (lfname);
if (owner <= 0)
@@ -354,6 +371,29 @@ t if it is locked by you, else a string of the name of the locker.")
return (lock_file_owner_name (lfname));
}
+
+/* Initialization functions. */
+
+init_filelock ()
+{
+ lock_path = egetenv ("EMACSLOCKDIR");
+ if (! lock_path)
+ lock_path = PATH_LOCK;
+
+ /* Make sure it ends with a slash. */
+ if (lock_path[strlen (lock_path) - 1] != '/')
+ {
+ lock_path = strcpy ((char *) xmalloc (strlen (lock_path) + 2),
+ lock_path);
+ strcat (lock_path, "/");
+ }
+
+ superlock_path = (char *) xmalloc ((strlen (lock_path)
+ + sizeof (SUPERLOCK_NAME)));
+ strcpy (superlock_path, lock_path);
+ strcat (superlock_path, SUPERLOCK_NAME);
+}
+
syms_of_filelock ()
{
defsubr (&Sunlock_buffer);
diff --git a/src/floatfns.c b/src/floatfns.c
index ed94c9ebafe..c99ba487e71 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -509,7 +509,11 @@ float_error (signo)
#ifdef BSD4_1
sigrelse (SIGILL);
#else /* not BSD4_1 */
- sigsetmask (0);
+ {
+ int dummy;
+
+ EMACS_SIGSETMASK (0, dummy);
+ }
#endif /* not BSD4_1 */
#else
/* Must reestablish handler each time it is called. */
diff --git a/src/keyboard.c b/src/keyboard.c
index c0f9ae4424b..122fa247c39 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2104,9 +2104,10 @@ gobble_input (expected)
#ifdef SIGIO
if (interrupt_input)
{
- SIGMASKTYPE mask = sigblockx (SIGIO);
+ SIGMASKTYPE mask;
+ EMACS_SIGBLOCKX (SIGIO, mask);
read_avail_input (expected);
- sigsetmask (mask);
+ EMACS_SIGSETMASK (mask, mask);
}
else
#endif
diff --git a/src/process.c b/src/process.c
index 442cae6d159..d9e2734957f 100644
--- a/src/process.c
+++ b/src/process.c
@@ -108,8 +108,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "termhooks.h"
#include "termopts.h"
#include "commands.h"
-
-extern int screen_garbaged;
+#include "dispextern.h"
Lisp_Object Qrun, Qstop, Qsignal, Qopen, Qclosed;
/* Qexit is declared and initialized in eval.c. */
@@ -419,6 +418,13 @@ allocate_pty ()
register c, i;
int fd;
+ /* Some systems name their pseudoterminals so that there are gaps in
+ the usual sequence - for example, on HP9000/S700 systems, there
+ are no pseudoterminals with names ending in 'f'. So we wait for
+ three failures in a row before deciding that we've reached the
+ end of the ptys. */
+ int failed_count = 0;
+
#ifdef PTY_ITERATION
PTY_ITERATION
#else
@@ -440,20 +446,27 @@ allocate_pty ()
#endif /* not HPUX */
#endif /* no PTY_NAME_SPRINTF */
-#ifndef IRIS
- if (stat (pty_name, &stb) < 0)
+#ifdef IRIS
+ /* Unusual IRIS code */
+ *ptyv = open ("/dev/ptc", O_RDWR | O_NDELAY, 0);
+ if (fd < 0)
+ return -1;
+ if (fstat (fd, &stb) < 0)
return -1;
+#else
+ if (stat (pty_name, &stb) < 0)
+ {
+ failed_count++;
+ if (failed_count >= 3)
+ return -1;
+ }
+ else
+ failed_count = 0;
#ifdef O_NONBLOCK
fd = open (pty_name, O_RDWR | O_NONBLOCK, 0);
#else
fd = open (pty_name, O_RDWR | O_NDELAY, 0);
#endif
-#else /* Unusual IRIS code */
- *ptyv = open ("/dev/ptc", O_RDWR | O_NDELAY, 0);
- if (fd < 0)
- return -1;
- if (fstat (fd, &stb) < 0)
- return -1;
#endif /* IRIS */
if (fd >= 0)
@@ -1742,11 +1755,6 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
if (!read_kbd)
FD_CLR (0, &Available);
- /* If a screen has been newly mapped and needs updating,
- reprocess its display stuff. */
- if (screen_garbaged)
- redisplay_preserve_echo_area ();
-
if (read_kbd && detect_input_pending ())
nfds = 0;
else
@@ -1829,6 +1837,16 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
if (! wait_proc)
got_some_input |= nfds > 0;
+ /* If checking input just got us a size-change event from X,
+ obey it now if we should. */
+ if (read_kbd)
+ do_pending_window_change ();
+
+ /* If screen size has changed, redisplay now
+ for either sit-for or keyboard input. */
+ if (read_kbd && screen_garbaged)
+ redisplay_preserve_echo_area ();
+
/* Check for data from a process or a command channel */
for (channel = FIRST_PROC_DESC; channel < MAXDESC; channel++)
{
diff --git a/src/s/aix3-1.h b/src/s/aix3-1.h
index 366ef832ed9..5b15772b16b 100644
--- a/src/s/aix3-1.h
+++ b/src/s/aix3-1.h
@@ -208,7 +208,7 @@ and this notice must be preserved on all copies. */
/* #define ADDR_CORRECT(x) (x) */
-#define LD_CMD cc
+#define LINKER cc
/* Prevent -lg from being used for debugging. Not needed. */
diff --git a/src/syntax.c b/src/syntax.c
index 4f203caf8f8..483526ebc35 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -158,12 +158,13 @@ DEFUN ("modify-syntax-entry", foo, bar, 0, 0, 0,
The syntax is changed only for table TABLE, which defaults to\n\
the current buffer's syntax table.\n\
The first character of S should be one of the following:\n\
- Space whitespace syntax. w word constituent.\n\
- _ symbol constituent. . punctuation.\n\
- ( open-parenthesis. ) close-parenthesis.\n\
- \" string quote. \\ character-quote.\n\
- $ paired delimiter. ' expression quote or prefix operator.\n\
- < comment starter. > comment ender.\n\
+ Space or - whitespace syntax. w word constituent.\n\
+ _ symbol constituent. . punctuation.\n\
+ ( open-parenthesis. ) close-parenthesis.\n\
+ \" string quote. \\ escape.\n\
+ $ paired delimiter. ' expression quote or prefix operator.\n\
+ < comment starter. > comment ender.\n\
+ / character-quote.\n\
Only single-character comment start and end sequences are represented thus.\n\
Two-character sequences are represented as described below.\n\
The second character of S is the matching parenthesis,\n\
diff --git a/src/sysdep.c b/src/sysdep.c
index 03614f98cce..62980380a68 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -638,7 +638,11 @@ reset_sigio ()
request_sigio ()
{
#ifdef SIGWINCH
- sigunblock (sigmask (SIGWINCH));
+ {
+ int dummy;
+
+ EMACS_SIGUNBLOCKX (SIGWINCH, dummy);
+ }
#endif
fcntl (0, F_SETFL, old_fcntl_flags | FASYNC);
@@ -648,7 +652,11 @@ request_sigio ()
unrequest_sigio ()
{
#ifdef SIGWINCH
- sigblock (sigmask (SIGWINCH));
+ {
+ int dummy;
+
+ EMACS_SIGBLOCK (SIGWINCH, dummy);
+ }
#endif
fcntl (0, F_SETFL, old_fcntl_flags);
interrupts_deferred = 1;
diff --git a/src/syssignal.h b/src/syssignal.h
index 81d52c8f758..cf5914458f2 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
#ifdef POSIX_SIGNALS
#define SIGMASKTYPE sigset_t
@@ -27,14 +28,19 @@ extern sigset_t empty_mask, full_mask, temp_mask;
#define sigmask(SIG) \
(sigemptyset (&temp_mask), sigaddset (&temp_mask, SIG), temp_mask)
-/* May need a local mask. There could be problems if code using any
- of the 3 macros below could be reentered due to a signal occurring.
- This can't happen in Emacs 18.57, so we don't worry. - DJB
- These macros also require GCC. */
-#define sigpause(SIG) ({ sigset_t _mask; sys_sigpause(SIG); })
-#define sigblock(SIG) ({ sigset_t _mask; sys_sigblock(SIG); })
-#define sigunblock(SIG) ({ sigset_t _mask; sys_sigunblock(SIG); })
-#define sigsetmask(SIG) ({ sigset_t _mask; sys_sigsetmask(SIG); })
+/* The below routines may need a local mask. There could be problems
+ if code using any of the 3 macros below could be reentered due to a
+ signal occurring. This can't happen in Emacs 18.57, so we don't
+ worry. - DJB */
+
+#define EMACS_SIGPAUSE(sigset) \
+ do { sigset_t _mask; sys_sigpause (sigset); } while (0)
+#define EMACS_SIGBLOCK(new_sig, old_sig) \
+ do { sigset_t _mask; (old_sig) = sys_sigblock (new_sig); } while (0)
+#define EMACS_SIGUNBLOCK(new_sig, old_sig) \
+ do { sigset_t _mask; (old_sig) = sys_sigunblock (new_sig); } while (0)
+#define EMACS_SIGSETMASK(new_sig, old_sig) \
+ do { sigset_t _mask; (old_sig) = sys_sigsetmask (new_sig); } while (0)
#define sighold(SIG) ONLY_USED_IN_BSD_4_1
#define sigrelse(SIG) ONLY_USED_IN_BSD_4_1
@@ -46,12 +52,12 @@ sigset_t sys_sigsetmask (sigset_t new_mask);
#define sys_sigdel(MASK,SIG) sigdelset(&MASK,SIG)
-#else /* not POSIX_SIGNALS */
+#else /* ! defined (POSIX_SIGNALS) */
#define sigunblock(SIG) \
{ SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
-#endif /* not POSIX_SIGNALS */
+#endif /* ! defined (POSIX_SIGNALS) */
#ifndef SIGMASKTYPE
#define SIGMASKTYPE int
@@ -65,21 +71,38 @@ sigset_t sys_sigsetmask (sigset_t new_mask);
#define sigmask(no) (1L << ((no) - 1))
#endif
-#ifndef BSD4_1
-#define sigfree() sigsetmask (SIGEMPTYMASK)
-#define sigholdx(sig) sigsetmask (sigmask (sig))
-#define sigblockx(sig) sigblock (sigmask (sig))
-#define sigunblockx(sig) sigblock (SIGEMPTYMASK)
-#define sigpausex(sig) sigpause (0)
-#endif /* not BSD4_1 */
-
#ifdef BSD4_1
#define SIGIO SIGTINT
/* sigfree and sigholdx are in sysdep.c */
-#define sigblockx(sig) sighold (sig)
-#define sigunblockx(sig) sigrelse (sig)
-#define sigpausex(sig) sigpause (sig)
-#endif /* BSD4_1 */
+#define EMACS_SIGFREE () sigfree ()
+
+/* We define the following macros to expand into statements rather
+ than expressions, because the POSIX macros above do the same, and
+ we don't want people on BSD4_1 systems accidentally using the
+ macros in a way that will break the other systems. */
+#define EMACS_SIGHOLDX(new_sig, old_sig) \
+ do { (old_sig) = sigholdx (new_sig); } while (0)
+#define EMACS_SIGBLOCKX(new_sig, old_sig) \
+ do { (old_sig) = sighold (new_sig); } while (0)
+#define EMACS_SIGUNBLOCKX(new_sig, old_sig) \
+ do { (old_sig) = sigrelse (new_sig); } while (0)
+#define EMACS_SIGPAUSEX(sig) \
+ EMACS_SIGPAUSE (new_sig);
+
+#else /* ! defined (BSD4_1) */
+
+#define EMACS_SIGFREE() \
+ do { SIGMASKTYPE _dummy; EMACS_SIGSETMASK (SIGEMPTYMASK, _dummy); } while (0)
+#define EMACS_SIGHOLDX(new_sig, old_sig) \
+ EMACS_SIGSETMASK (sigmask (new_sig), old_sig)
+#define EMACS_SIGBLOCKX(new_sig, old_sig) \
+ EMACS_SIGBLOCK (sigmask (new_sig), old_sig)
+#define EMACS_SIGUNBLOCKX(new_sig, old_sig) \
+ EMACS_SIGUNBLOCK (sigmask (new_sig), old_sig)
+#define EMACS_SIGPAUSEX(sig) \
+ EMACS_SIGPAUSE (0)
+
+#endif /* ! defined (BSD4_1) */
/* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
Must do that using the killpg call. */
@@ -96,6 +119,6 @@ sigset_t sys_sigsetmask (sigset_t new_mask);
#ifdef SIGCLD
#ifndef SIGCHLD
#define SIGCHLD SIGCLD
-#endif /* not SIGCHLD */
-#endif /* SIGCLD */
-#endif /* not VMS */
+#endif /* SIGCHLD */
+#endif /* ! defined (SIGCLD) */
+#endif /* VMS */