]> code.delx.au - gnu-emacs/blobdiff - src/s/gnu-linux.h
(GC_MARK_STACK): Define to GC_MAKE_GCPROS_NOOPS.
[gnu-emacs] / src / s / gnu-linux.h
index 8e39773c6c601a4c00930c05073615b29eeb61ea..7b2a6647f8482a9ca237f2c645c46d7ff42ef509 100644 (file)
@@ -54,63 +54,59 @@ Boston, MA 02111-1307, USA.  */
 #endif /* emacs */
 #endif /* NOT_C_CODE */
 
-/* Letter to use in finding device name of first pty,
-  if system supports pty's.  'p' means it is /dev/ptyp0  */
+#if defined HAVE_GRANTPT
+#define UNIX98_PTYS
 
-#define FIRST_PTY_LETTER 'p'
+/* Run only once.  We need a `for'-loop because the code uses
+   `continue'.  */
 
-#ifdef HAVE_DEV_PTMX
+#define PTY_ITERATION  for (i = 0; i < 1; i++)
 
-/* This is the same definition as in usg5-4.h, but with sigblock/sigunblock
-   rather than sighold/sigrelse, which appear to be BSD4.1 specific and won't
-   work if POSIX_SIGNALS is defined.  It may also be appropriate for SVR4.x
-   (x<2) but I'm not sure.   fnf@cygnus.com */
-/* This sets the name of the slave side of the PTY.  On SysVr4,
-   grantpt(3) forks a subprocess, so keep sigchld_handler() from
-   intercepting that death.  If any child but grantpt's should die
-   within, it should be caught after sigrelse(2). */
+#ifdef HAVE_GETPT
+#define PTY_NAME_SPRINTF
+#define PTY_OPEN fd = getpt ()
+#else /* not HAVE_GETPT */
+#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
+#endif /* not HAVE_GETPT */
+
+/* Note that grantpt and unlockpt may fork.  We must block SIGCHLD to
+   prevent sigchld_handler from intercepting the child's death.  */
+
+#define PTY_TTY_NAME_SPRINTF                           \
+  {                                                    \
+    char *ptyname;                                     \
+                                                       \
+    sigblock (sigmask (SIGCHLD));                      \
+    if (grantpt (fd) == -1 || unlockpt (fd) == -1      \
+        || !(ptyname = ptsname(fd)))                   \
+      {                                                        \
+       sigunblock (sigmask (SIGCHLD));                 \
+       close (fd);                                     \
+       return -1;                                      \
+      }                                                        \
+    strncpy (pty_name, ptyname, sizeof (pty_name));    \
+    pty_name[sizeof (pty_name) - 1] = 0;               \
+    sigunblock (sigmask (SIGCHLD));                    \
+  }
 
-#undef FIRST_PTY_LETTER
-#define FIRST_PTY_LETTER 'z'
+#else /* not HAVE_GRANTPT */
 
-/* This sets the name of the master side of the PTY. */
-#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
+/* Letter to use in finding device name of first pty,
+   if system supports pty's.  'p' means it is /dev/ptyp0  */
 
-#undef PTY_TTY_NAME_SPRINTF
-/* This used to use SIGCLD, but that doesn't appear in glibc 2.1.  */
-#define PTY_TTY_NAME_SPRINTF                   \
-  {                                            \
-    char *ptsname (), *ptyname;                        \
-                                               \
-    sigblock (sigmask (SIGCHLD));              \
-    if (grantpt (fd) == -1)                    \
-      { close (fd); return -1; }               \
-    sigunblock (sigmask (SIGCHLD));            \
-    if (unlockpt (fd) == -1)                   \
-      { close (fd); return -1; }               \
-    if (!(ptyname = ptsname (fd)))             \
-      { close (fd); return -1; }               \
-    strncpy (pty_name, ptyname, sizeof (pty_name)); \
-    pty_name[sizeof (pty_name) - 1] = 0;       \
-  }
+#define FIRST_PTY_LETTER 'p'
 
-#endif /* HAVE_DEV_PTMX */
+#endif  /* not HAVE_GRANDPT */
 
-/*
- *     Define HAVE_TERMIOS if the system provides POSIX-style
- *     functions and macros for terminal control.
- */
+/*  Define HAVE_TERMIOS if the system provides POSIX-style
+    functions and macros for terminal control.  */
 
 #define HAVE_TERMIOS
 
-/*
- *     Define HAVE_PTYS if the system supports pty devices.
- */
+/* Define HAVE_PTYS if the system supports pty devices. */
 
 #define HAVE_PTYS
 
-/* Uncomment this later when other problems are dealt with -mkj */
-
 #define HAVE_SOCKETS
 
 /* Define this symbol if your system has the functions bcopy, etc. */
@@ -209,7 +205,6 @@ Boston, MA 02111-1307, USA.  */
 
 #define NO_SIOCTL_H           /* don't have sioctl.h */
 
-#define HAVE_GETWD            /* cure conflict with getcwd? */
 #define HAVE_WAIT_HEADER
 
 #define SYSV_SYSTEM_DIR       /* use dirent.h */
@@ -319,7 +314,6 @@ Boston, MA 02111-1307, USA.  */
    actually set a process group. */
 
 #define BSD_PGRPS
-#define setpgrp(pid,pgid) setpgid(pid,pgid)
 
 #define NARROWPROTO 1
 
@@ -333,6 +327,11 @@ Boston, MA 02111-1307, USA.  */
    jmp_buf.  */
 /* m68k and alpha aren't tested, but there are Debian packages for SCM
    and/or Guile on them, so the technique must work.  */
-#if #cpu (i386) || #cpu (sparc) || #cpu (m68k) || #cpu (alpha)
+
+/* Don't use #cpu here since in newest development versions of GCC,
+   we must call cpp with -traditional, and that disables #cpu.  */
+
+#if defined __i386__ || defined __sparc__ || defined __m68k__ || defined __alpha__
 #define GC_SETJMP_WORKS 1
+#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
 #endif