Mercurial > emacs
changeset 624:2bb7f23b7ea5
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Fri, 01 May 1992 06:20:46 +0000 |
parents | 347a8db13650 |
children | ce011f7cd03f |
files | Makefile.in src/alloc.c src/callproc.c src/data.c src/emacs.c src/filelock.c src/floatfns.c src/keyboard.c src/process.c src/s/aix3-1.h src/syntax.c src/sysdep.c src/syssignal.h |
diffstat | 13 files changed, 208 insertions(+), 96 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.in Thu Apr 30 10:37:15 1992 +0000 +++ b/Makefile.in Fri May 01 06:20:46 1992 +0000 @@ -127,8 +127,7 @@ -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
--- a/src/alloc.c Thu Apr 30 10:37:15 1992 +0000 +++ b/src/alloc.c Fri May 01 06:20:46 1992 +0000 @@ -551,8 +551,9 @@ 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 ();
--- a/src/callproc.c Thu Apr 30 10:37:15 1992 +0000 +++ b/src/callproc.c Fri May 01 06:20:46 1992 +0000 @@ -224,7 +224,11 @@ /* 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 @@ 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);
--- a/src/data.c Thu Apr 30 10:37:15 1992 +0000 +++ b/src/data.c Fri May 01 06:20:46 1992 +0000 @@ -1959,7 +1959,11 @@ #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);
--- a/src/emacs.c Thu Apr 30 10:37:15 1992 +0000 +++ b/src/emacs.c Fri May 01 06:20:46 1992 +0000 @@ -442,6 +442,9 @@ 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 */
--- a/src/filelock.c Thu Apr 30 10:37:15 1992 +0000 +++ b/src/filelock.c Fri May 01 06:20:46 1992 +0000 @@ -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 @@ 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 @@ #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 @@ 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_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 @@ { 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 @@ { 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 @@ if (fd >= 0) { #ifdef USG - chmod (PATH_SUPERLOCK, 0666); + chmod (superlock_path, 0666); #else fchmod (fd, 0666); #endif @@ -341,9 +360,7 @@ 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 @@ 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);
--- a/src/floatfns.c Thu Apr 30 10:37:15 1992 +0000 +++ b/src/floatfns.c Fri May 01 06:20:46 1992 +0000 @@ -509,7 +509,11 @@ #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. */
--- a/src/keyboard.c Thu Apr 30 10:37:15 1992 +0000 +++ b/src/keyboard.c Fri May 01 06:20:46 1992 +0000 @@ -2104,9 +2104,10 @@ #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
--- a/src/process.c Thu Apr 30 10:37:15 1992 +0000 +++ b/src/process.c Fri May 01 06:20:46 1992 +0000 @@ -108,8 +108,7 @@ #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 @@ 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 @@ #endif /* not HPUX */ #endif /* no PTY_NAME_SPRINTF */ -#ifndef IRIS +#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) - return -1; + { + 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 @@ 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 @@ 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++) {
--- a/src/s/aix3-1.h Thu Apr 30 10:37:15 1992 +0000 +++ b/src/s/aix3-1.h Fri May 01 06:20:46 1992 +0000 @@ -208,7 +208,7 @@ /* #define ADDR_CORRECT(x) (x) */ -#define LD_CMD cc +#define LINKER cc /* Prevent -lg from being used for debugging. Not needed. */
--- a/src/syntax.c Thu Apr 30 10:37:15 1992 +0000 +++ b/src/syntax.c Fri May 01 06:20:46 1992 +0000 @@ -158,12 +158,13 @@ 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\
--- a/src/sysdep.c Thu Apr 30 10:37:15 1992 +0000 +++ b/src/sysdep.c Fri May 01 06:20:46 1992 +0000 @@ -638,7 +638,11 @@ 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 @@ unrequest_sigio () { #ifdef SIGWINCH - sigblock (sigmask (SIGWINCH)); + { + int dummy; + + EMACS_SIGBLOCK (SIGWINCH, dummy); + } #endif fcntl (0, F_SETFL, old_fcntl_flags); interrupts_deferred = 1;
--- a/src/syssignal.h Thu Apr 30 10:37:15 1992 +0000 +++ b/src/syssignal.h Fri May 01 06:20:46 1992 +0000 @@ -17,6 +17,7 @@ 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 @@ #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 @@ #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 @@ #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 @@ #ifdef SIGCLD #ifndef SIGCHLD #define SIGCHLD SIGCLD -#endif /* not SIGCHLD */ -#endif /* SIGCLD */ -#endif /* not VMS */ +#endif /* SIGCHLD */ +#endif /* ! defined (SIGCLD) */ +#endif /* VMS */