/* Interfaces to system-dependent kernel and library entries.
- Copyright (C) 1985, 1986, 1987, 1988, 1992 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1986, 1987, 1988, 1993 Free Software Foundation, Inc.
This file is part of GNU Emacs.
status = SYS$FORCEX (&pid, 0, 0);
break;
#else /* not VMS */
-
- /* Exit if the process has terminated. */
- if (!synch_process_alive)
+#if (defined (BSD) && !defined (LINUX)) || (defined (HPUX) && !defined (HPUX_5))
+ /* Note that kill returns -1 even if the process is just a zombie now.
+ But inevitably a SIGCHLD interrupt should be generated
+ and child_sig will do wait3 and make the process go away. */
+ /* There is some indication that there is a bug involved with
+ termination of subprocesses, perhaps involving a kernel bug too,
+ but no idea what it is. Just as a hunch we signal SIGCHLD to see
+ if that causes the problem to go away or get worse. */
+ sigsetmask (sigmask (SIGCHLD));
+ if (0 > kill (pid, 0))
+ {
+ sigsetmask (SIGEMPTYMASK);
+ kill (getpid (), SIGCHLD);
+ break;
+ }
+ if (wait_debugging)
+ sleep (1);
+ else
+ sigpause (SIGEMPTYMASK);
+#else /* not BSD, not LINUX, and not HPUX version >= 6 */
+#if defined (UNIPLUS) || defined (LINUX)
+ if (0 > kill (pid, 0))
break;
- /* Otherwise wait 1 second or until a signal comes in. */
- signal (SIGALRM, wait_for_termination_signal);
- alarm (1);
- pause ();
- alarm (0);
- signal (SIGALRM, SIG_IGN);
+ wait (0);
+#else /* neither BSD nor UNIPLUS nor LINUX: random sysV */
+#ifdef POSIX_SIGNALS /* would this work for LINUX as well? */
+ sigblock (sigmask (SIGCHLD));
+ if (0 > kill (pid, 0))
+ {
+ sigunblock (sigmask (SIGCHLD));
+ break;
+ }
+ sigpause (sigmask (SIGCHLD));
+#else /* not POSIX_SIGNALS */
+#ifdef HAVE_SYSV_SIGPAUSE
+ sighold (SIGCHLD);
+ if (0 > kill (pid, 0))
+ {
+ sigrelse (SIGCHLD);
+ break;
+ }
+ sigpause (SIGCHLD);
+#else /* not HAVE_SYSV_SIGPAUSE */
+ if (0 > kill (pid, 0))
+ break;
+ /* Using sleep instead of pause avoids timing error.
+ If the inferior dies just before the sleep,
+ we lose just one second. */
+ sleep (1);
+#endif /* not HAVE_SYSV_SIGPAUSE */
+#endif /* not POSIX_SIGNALS */
+#endif /* not UNIPLUS */
+#endif /* not BSD, and not HPUX version >= 6 */
#endif /* not VMS */
#else /* not subprocesses */
#ifndef BSD4_1
}
save_signal_handlers (saved_handlers);
+ synch_process_alive = 1;
wait_for_termination (pid);
restore_signal_handlers (saved_handlers);
#endif
/* Suivant - Do we have to get struct ltchars data? */
-#ifdef TIOCGLTC
+#ifdef HAVE_LTCHARS
if (ioctl (fd, TIOCGLTC, &settings->ltchars) < 0)
return -1;
#endif
/* How about a struct tchars and a wordful of lmode bits? */
-#ifdef TIOCGETC
+#ifdef HAVE_TCHARS
if (ioctl (fd, TIOCGETC, &settings->tchars) < 0
|| ioctl (fd, TIOCLGET, &settings->lmode) < 0)
return -1;
#endif
/* Suivant - Do we have to get struct ltchars data? */
-#ifdef TIOCGLTC
+#ifdef HAVE_LTCHARS
if (ioctl (fd, TIOCSLTC, &settings->ltchars) < 0)
return -1;
#endif
/* How about a struct tchars and a wordful of lmode bits? */
-#ifdef TIOCGETC
+#ifdef HAVE_TCHARS
if (ioctl (fd, TIOCSETC, &settings->tchars) < 0
|| ioctl (fd, TIOCLSET, &settings->lmode) < 0)
return -1;
char _sobuf[BUFSIZ];
#endif
-#ifdef TIOCGLTC
+#ifdef HAVE_LTCHARS
static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1};
#endif
-#ifdef TIOCGETC
+#ifdef HAVE_TCHARS
static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1};
#endif
control for user coming over network on 4.2; in this case,
only t_stopc and t_startc really matter. */
#ifndef HAVE_TERMIO
-#ifdef TIOCGETC
+#ifdef HAVE_TCHARS
/* Note: if not using CBREAK mode, it makes no difference how we
set this */
tty.tchars = new_tchars;
lmode = tty.lmode;
#endif
-#endif /* TIOCGETC */
+#endif /* HAVE_TCHARS */
#endif /* not HAVE_TERMIO */
-#ifdef TIOCGLTC
+#ifdef HAVE_LTCHARS
tty.ltchars = new_ltchars;
-#endif /* TIOCGLTC */
+#endif /* HAVE_LTCHARS */
EMACS_SET_TTY (input_fd, &tty, 0);
#endif /* not HAVE_GETHOSTNAME */
#endif /* USG */
+#ifndef BSD4_1
+#ifndef USG
+#ifndef VMS
+#ifdef HAVE_SOCKETS
+#include <sys/socket.h>
+#include <netdb.h>
+#endif /* HAVE_SOCKETS */
+#endif /* not VMS */
+#endif /* not USG */
+#endif /* not BSD4_1 */
+
char *
get_system_name ()
{
strcpy (system_name_saved, sp);
#else /* not VMS */
gethostname (system_name_saved, sizeof (system_name_saved));
+#ifdef HAVE_SOCKETS
+ /* Turn the hostname into the official, fully-qualified hostname.
+ Don't do this if we're going to dump; this can confuse system
+ libraries on some machines and make the dumped emacs core dump. */
+#ifndef CANNOT_DUMP
+ if (initialized)
+#endif /* not CANNOT_DUMP */
+ {
+ struct hostent *hp;
+ hp = gethostbyname (system_name_saved);
+ if (hp && strlen (hp->h_name) < sizeof(system_name_saved))
+ strcpy (system_name_saved, hp->h_name);
+ }
+#endif /* HAVE_SOCKETS */
#endif /* not VMS */
return system_name_saved;
#endif /* not USG, not 4.1 */
#else
sigemptyset (&new_action.sa_mask);
new_action.sa_handler = action;
- new_action.sa_flags = NULL;
+ new_action.sa_flags = 0;
sigaction (signal_number, &new_action, &old_action);
return (old_action.sa_handler);
#endif /* DGUX */
#endif /* not AIX */
0
};
-#endif HAVE_SYS_SIGLIST
+#endif /* HAVE_SYS_SIGLIST */
/*
* Warning, this function may not duplicate 4.2 action properly
tp->tv_sec = time ((long *)0);
tp->tv_usec = 0;
- tzp->tz_minuteswest = -1;
+ if (tzp != 0)
+ tzp->tz_minuteswest = -1;
}
#endif