psss / rpms / libguestfs

Forked from rpms/libguestfs 5 years ago
Clone
e83612e
From 20acc6cf3ebf873497e0be95bd5d3daad56cecd5 Mon Sep 17 00:00:00 2001
3f26098
From: "Richard W.M. Jones" <rjones@redhat.com>
3f26098
Date: Thu, 2 Mar 2017 13:46:48 +0000
3f26098
Subject: [PATCH 04/10] rescue: Modify virt-rescue so it doesn't use direct
3f26098
 mode (RHBZ#1152819, RHBZ#1171654).
3f26098
3f26098
Instead of using "direct mode" (which was basically a quick hack),
3f26098
virt-rescue now launches the appliance with a running daemon.
3f26098
3f26098
The daemon doesn't do much -- there is still a bash shell which the
3f26098
user interacts with.  The daemon is there simply to provide the
3f26098
initial GUESTFS_LAUNCH_FLAG message and to handle shutdown a bit more
3f26098
gracefully.
3f26098
3f26098
To interact with the shell, and replacing direct mode, virt-rescue now
3f26098
prints out log messages (the output of the shell), and sends input
3f26098
typed by the user directly to the console socket.  This uses the
3f26098
guestfs_internal_get_console_socket API added previously.  Most of the
3f26098
complexity behind this is hidden in virt-rescue.
3f26098
3f26098
This fully fixes the handling of ^C (RHBZ#1152819).  Also there were
3f26098
earlier reports that full screen commands like 'vim' didn't work well,
3f26098
(RHBZ#1171654), but in this version vim appears to work fine, albeit
3f26098
only using 80x24 of the screen because of the serial console.
3f26098
3f26098
(cherry picked from commit 32d60801443647b3523b9374c431fefdbf054e3c)
3f26098
---
c4bd84b
 appliance/init     |  91 ++++++++--------
3f26098
 rescue/Makefile.am |   1 +
3f26098
 rescue/rescue.c    | 306 +++++++++++++++++++++++++++++++++++++++++++++--------
c4bd84b
 3 files changed, 312 insertions(+), 86 deletions(-)
3f26098
3f26098
diff --git a/appliance/init b/appliance/init
1ab6357
index 8a26e1a02..810f84d22 100755
3f26098
--- a/appliance/init
3f26098
+++ b/appliance/init
3f26098
@@ -159,59 +159,62 @@ if test "$guestfs_verbose" = 1 && test "$guestfs_boot_analysis" != 1; then
3f26098
     echo -n "uptime: "; cat /proc/uptime
3f26098
 fi
3f26098
 
3f26098
-if ! test "$guestfs_rescue" = 1; then
3f26098
-  # Run the daemon.
3f26098
-  cmd="guestfsd"
3f26098
-  eval `grep -Eo 'guestfs_channel=[^[:space:]]+' /proc/cmdline`
3f26098
-  if test "x$guestfs_channel" != "x"; then
3f26098
+# Run the daemon.
3f26098
+cmd="guestfsd"
3f26098
+eval `grep -Eo 'guestfs_channel=[^[:space:]]+' /proc/cmdline`
3f26098
+if test "x$guestfs_channel" != "x"; then
3f26098
     cmd="$cmd --channel $guestfs_channel"
3f26098
-  fi
3f26098
-  if test "$guestfs_verbose" = 1; then
3f26098
+fi
3f26098
+if test "$guestfs_verbose" = 1; then
3f26098
     cmd="$cmd --verbose"
3f26098
-  fi
3f26098
-  if test "$guestfs_network" = 1; then
3f26098
+fi
3f26098
+if test "$guestfs_network" = 1; then
3f26098
     cmd="$cmd --network"
3f26098
-  fi
3f26098
-  echo $cmd
3f26098
-  $cmd
3f26098
+fi
3f26098
+if ! test "$guestfs_rescue" = 1; then
3f26098
+    echo $cmd
3f26098
+    $cmd
3f26098
 else
3f26098
-  # Run virt-rescue shell.
c4bd84b
+    # Run virt-rescue shell.
c4bd84b
 
3f26098
-  # Get name of the serial port, from console= passed by libguestfs.
3f26098
-  guestfs_serial=$(grep -Eo 'console=[^[:space:]]+' /proc/cmdline |
3f26098
-                   sed s/console=//)
c4bd84b
+    # We need a daemon, even in virt-rescue.
c4bd84b
+    $cmd &
c4bd84b
 
3f26098
-  # Remove LD_PRELOAD=libSegFault set above.
3f26098
-  unset LD_PRELOAD
c4bd84b
+    # Get name of the serial port, from console= passed by libguestfs.
c4bd84b
+    guestfs_serial=$(grep -Eo 'console=[^[:space:]]+' /proc/cmdline |
c4bd84b
+                     sed s/console=//)
c4bd84b
 
3f26098
-  :> $HOME/.bashrc
3f26098
-  grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline >> $HOME/.bashrc
3f26098
-  echo "PS1='><rescue> '" >> $HOME/.bashrc
3f26098
-  echo "export TERM PS1" >> $HOME/.bashrc
c4bd84b
+    # Remove LD_PRELOAD=libSegFault set above.
c4bd84b
+    unset LD_PRELOAD
c4bd84b
 
3f26098
-  # The shell is opened by default on /dev/console, which (on Linux)
3f26098
-  # is not a controlling terminal, causing job control to fail.  For
3f26098
-  # how we work around this, see:
3f26098
-  # https://busybox.net/FAQ.html#job_control
3f26098
-  run_bash_with_ctty ()
3f26098
-  {
3f26098
-    setsid bash -c \
3f26098
-      "exec bash </dev/$guestfs_serial >/dev/$guestfs_serial 2>&1"
3f26098
-  }
c4bd84b
+    :> $HOME/.bashrc
c4bd84b
+    grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline >> $HOME/.bashrc
c4bd84b
+    echo "PS1='><rescue> '" >> $HOME/.bashrc
c4bd84b
+    echo "export TERM PS1" >> $HOME/.bashrc
c4bd84b
 
3f26098
-  echo
3f26098
-  echo "------------------------------------------------------------"
3f26098
-  echo
3f26098
-  echo "Welcome to virt-rescue, the libguestfs rescue shell."
3f26098
-  echo
3f26098
-  echo "Note: The contents of / are the rescue appliance."
3f26098
-  echo "You have to mount the guest's partitions under /sysroot"
3f26098
-  echo "before you can examine them."
3f26098
-  echo
3f26098
-  run_bash_with_ctty
3f26098
-  echo
3f26098
-  echo "virt-rescue: Syncing the disk now before exiting ..."
3f26098
-  echo
3f26098
+    # The shell is opened by default on /dev/console, which (on Linux)
3f26098
+    # is not a controlling terminal, causing job control to fail.  For
3f26098
+    # how we work around this, see:
3f26098
+    # https://busybox.net/FAQ.html#job_control
3f26098
+    run_bash_with_ctty ()
3f26098
+    {
3f26098
+        setsid bash -c \
3f26098
+            "exec bash </dev/$guestfs_serial >/dev/$guestfs_serial 2>&1"
3f26098
+    }
3f26098
+
3f26098
+    echo
3f26098
+    echo "------------------------------------------------------------"
3f26098
+    echo
3f26098
+    echo "Welcome to virt-rescue, the libguestfs rescue shell."
3f26098
+    echo
3f26098
+    echo "Note: The contents of / (root) are the rescue appliance."
3f26098
+    echo "You have to mount the guest's partitions under /sysroot"
3f26098
+    echo "before you can examine them."
3f26098
+    echo
3f26098
+    run_bash_with_ctty
3f26098
+    echo
3f26098
+    echo "virt-rescue: Syncing the disk now before exiting ..."
3f26098
+    echo
3f26098
 fi
3f26098
 
3f26098
 sync
3f26098
diff --git a/rescue/Makefile.am b/rescue/Makefile.am
1ab6357
index 7919aafd5..99d4b79ae 100644
3f26098
--- a/rescue/Makefile.am
3f26098
+++ b/rescue/Makefile.am
3f26098
@@ -30,6 +30,7 @@ virt_rescue_SOURCES = \
3f26098
 
3f26098
 virt_rescue_CPPFLAGS = \
3f26098
 	-DGUESTFS_WARN_DEPRECATED=1 \
3f26098
+	-DGUESTFS_PRIVATE=1 \
3f26098
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
3f26098
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
3f26098
 	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
3f26098
diff --git a/rescue/rescue.c b/rescue/rescue.c
1ab6357
index b692e5a07..b145dcd40 100644
3f26098
--- a/rescue/rescue.c
3f26098
+++ b/rescue/rescue.c
3f26098
@@ -23,21 +23,32 @@
3f26098
 #include <string.h>
3f26098
 #include <inttypes.h>
3f26098
 #include <unistd.h>
3f26098
+#include <fcntl.h>
3f26098
 #include <getopt.h>
3f26098
 #include <errno.h>
3f26098
 #include <error.h>
3f26098
+#include <signal.h>
3f26098
+#include <termios.h>
3f26098
+#include <poll.h>
3f26098
 #include <locale.h>
3f26098
 #include <assert.h>
3f26098
 #include <libintl.h>
3f26098
 
3f26098
+#include "full-write.h"
3f26098
+#include "getprogname.h"
3f26098
 #include "ignore-value.h"
3f26098
 #include "xvasprintf.h"
3f26098
-#include "getprogname.h"
3f26098
 
3f26098
 #include "guestfs.h"
3f26098
 #include "options.h"
3f26098
 #include "display-options.h"
3f26098
 
3f26098
+static void log_message_callback (guestfs_h *g, void *opaque, uint64_t event, int event_handle, int flags, const char *buf, size_t buf_len, const uint64_t *array, size_t array_len);
3f26098
+static void do_rescue (int sock);
3f26098
+static void raw_tty (void);
3f26098
+static void restore_tty (void);
3f26098
+static void tstp_handler (int sig);
3f26098
+static void cont_handler (int sig);
3f26098
 static void add_scratch_disks (int n, struct drv **drvs);
3f26098
 static void do_suggestion (struct drv *drvs);
3f26098
 
3f26098
@@ -54,6 +65,9 @@ int inspector = 0;
3f26098
 int in_guestfish = 0;
3f26098
 int in_virt_rescue = 1;
3f26098
 
3f26098
+/* Old terminal settings. */
3f26098
+static struct termios old_termios;
3f26098
+
3f26098
 static void __attribute__((noreturn))
3f26098
 usage (int status)
3f26098
 {
3f26098
@@ -135,6 +149,8 @@ main (int argc, char *argv[])
3f26098
   int memsize = 0;
3f26098
   int smp = 0;
3f26098
   int suggest = 0;
3f26098
+  char *append_full;
3f26098
+  int sock;
3f26098
 
3f26098
   g = guestfs_create ();
3f26098
   if (g == NULL)
3f26098
@@ -295,30 +311,6 @@ main (int argc, char *argv[])
3f26098
     usage (EXIT_FAILURE);
3f26098
   }
3f26098
 
3f26098
-#pragma GCC diagnostic push
3f26098
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
3f26098
-  /* Setting "direct mode" is required for the rescue appliance. */
3f26098
-  if (guestfs_set_direct (g, 1) == -1)
3f26098
-    exit (EXIT_FAILURE);
3f26098
-#pragma GCC diagnostic pop
3f26098
-
3f26098
-  {
3f26098
-    /* The libvirt backend doesn't support direct mode.  As a temporary
3f26098
-     * workaround, force the appliance backend, but warn about it.
3f26098
-     */
3f26098
-    CLEANUP_FREE char *backend = guestfs_get_backend (g);
3f26098
-    if (backend) {
3f26098
-      if (STREQ (backend, "libvirt") ||
3f26098
-          STRPREFIX (backend, "libvirt:")) {
3f26098
-        fprintf (stderr, _("%s: warning: virt-rescue doesn't work with the libvirt backend\n"
3f26098
-                           "at the moment.  As a workaround, forcing backend = 'direct'.\n"),
3f26098
-                 getprogname ());
3f26098
-        if (guestfs_set_backend (g, "direct") == -1)
3f26098
-          exit (EXIT_FAILURE);
3f26098
-      }
3f26098
-    }
3f26098
-  }
3f26098
-
3f26098
   /* Set other features. */
3f26098
   if (memsize > 0)
3f26098
     if (guestfs_set_memsize (g, memsize) == -1)
3f26098
@@ -330,16 +322,15 @@ main (int argc, char *argv[])
3f26098
     if (guestfs_set_smp (g, smp) == -1)
3f26098
       exit (EXIT_FAILURE);
3f26098
 
3f26098
-  {
3f26098
-    /* Kernel command line must include guestfs_rescue=1 (see
3f26098
-     * appliance/init) as well as other options.
3f26098
-     */
3f26098
-    CLEANUP_FREE char *append_full = xasprintf ("guestfs_rescue=1%s%s",
3f26098
-                                                append ? " " : "",
3f26098
-                                                append ? append : "");
3f26098
-    if (guestfs_set_append (g, append_full) == -1)
3f26098
-      exit (EXIT_FAILURE);
3f26098
-  }
3f26098
+  /* Kernel command line must include guestfs_rescue=1 (see
3f26098
+   * appliance/init) as well as other options.
3f26098
+   */
3f26098
+  append_full = xasprintf ("guestfs_rescue=1%s%s",
3f26098
+                           append ? " " : "",
3f26098
+                           append ? append : "");
3f26098
+  if (guestfs_set_append (g, append_full) == -1)
3f26098
+    exit (EXIT_FAILURE);
3f26098
+  free (append_full);
3f26098
 
3f26098
   /* Add drives. */
1ab6357
   add_drives (drvs);
3f26098
@@ -347,22 +338,253 @@ main (int argc, char *argv[])
3f26098
   /* Free up data structures, no longer needed after this point. */
3f26098
   free_drives (drvs);
3f26098
 
3f26098
-  /* Run the appliance.  This won't return until the user quits the
3f26098
-   * appliance.
3f26098
+  /* Add an event handler to print "log messages".  These will be the
3f26098
+   * output of the appliance console during launch and shutdown.
3f26098
+   * After launch, we will read the console messages directly from the
3f26098
+   * socket and they won't be passed through the event callback.
c4bd84b
    */
c4bd84b
-  if (!verbose)
c4bd84b
-    guestfs_set_error_handler (g, NULL, NULL);
3f26098
+  if (guestfs_set_event_callback (g, log_message_callback,
3f26098
+                                  GUESTFS_EVENT_APPLIANCE, 0, NULL) == -1)
3f26098
+    exit (EXIT_FAILURE);
c4bd84b
 
c4bd84b
-  /* We expect launch to fail, so ignore the return value, and don't
c4bd84b
-   * bother with explicit guestfs_shutdown either.
3f26098
+  /* Run the appliance. */
3f26098
+  if (guestfs_launch (g) == -1)
3f26098
+    exit (EXIT_FAILURE);
3f26098
+
3f26098
+  sock = guestfs_internal_get_console_socket (g);
3f26098
+  if (sock == -1)
3f26098
+    exit (EXIT_FAILURE);
3f26098
+
3f26098
+  /* Try to set all sockets to non-blocking. */
3f26098
+  if (fcntl (STDIN_FILENO, F_SETFL, O_NONBLOCK) == -1)
3f26098
+    perror ("could not set stdin to non-blocking");
3f26098
+  if (fcntl (STDOUT_FILENO, F_SETFL, O_NONBLOCK) == -1)
3f26098
+    perror ("could not set stdout to non-blocking");
3f26098
+  if (fcntl (sock, F_SETFL, O_NONBLOCK) == -1)
3f26098
+    perror ("could not set console socket to non-blocking");
3f26098
+
3f26098
+  /* Save the initial state of the tty so we always have the original
3f26098
+   * state to go back to.
c4bd84b
+   */
3f26098
+  if (tcgetattr (STDIN_FILENO, &old_termios) == -1) {
3f26098
+    perror ("tcgetattr: stdin");
3f26098
+    exit (EXIT_FAILURE);
3f26098
+  }
c4bd84b
+
3f26098
+  /* Put stdin in raw mode so that we can receive ^C and other
3f26098
+   * special keys.
c4bd84b
+   */
3f26098
+  raw_tty ();
3f26098
+
3f26098
+  /* Restore the tty settings when the process exits. */
3f26098
+  atexit (restore_tty);
3f26098
+
3f26098
+  /* Catch tty stop and cont signals so we can cleanup.
3f26098
+   * See https://www.gnu.org/software/libc/manual/html_node/Signaling-Yourself.html
c4bd84b
    */
c4bd84b
-  ignore_value (guestfs_launch (g));
3f26098
+  signal (SIGTSTP, tstp_handler);
3f26098
+  signal (SIGCONT, cont_handler);
3f26098
+
3f26098
+  do_rescue (sock);
3f26098
+
3f26098
+  restore_tty ();
3f26098
+
3f26098
+  /* Shut down the appliance. */
3f26098
+  guestfs_push_error_handler (g, NULL, NULL);
3f26098
+  if (guestfs_shutdown (g) == -1) {
3f26098
+    const char *err;
3f26098
+
3f26098
+    /* Ignore "appliance closed the connection unexpectedly" since
3f26098
+     * this can happen if the user reboots the appliance.
3f26098
+     */
3f26098
+    if (guestfs_last_errno (g) == EPIPE)
3f26098
+      goto next;
3f26098
 
3f26098
+    /* Otherwise it's a real error. */
3f26098
+    err = guestfs_last_error (g);
3f26098
+    fprintf (stderr, "libguestfs: error: %s\n", err);
3f26098
+    exit (EXIT_FAILURE);
3f26098
+  }
3f26098
+ next:
3f26098
+  guestfs_pop_error_handler (g);
3f26098
   guestfs_close (g);
3f26098
 
3f26098
   exit (EXIT_SUCCESS);
3f26098
 }
3f26098
 
3f26098
+static void
3f26098
+log_message_callback (guestfs_h *g, void *opaque, uint64_t event,
3f26098
+                      int event_handle, int flags,
3f26098
+                      const char *buf, size_t buf_len,
3f26098
+                      const uint64_t *array, size_t array_len)
3f26098
+{
3f26098
+  if (buf_len > 0) {
3f26098
+    ignore_value (full_write (STDOUT_FILENO, buf, buf_len));
3f26098
+  }
3f26098
+}
3f26098
+
3f26098
+/* This is the main loop for virt-rescue.  We read and write
3f26098
+ * directly to the console socket.
3f26098
+ */
3f26098
+#define BUFSIZE 4096
3f26098
+static char rbuf[BUFSIZE];      /* appliance -> local tty */
3f26098
+static char wbuf[BUFSIZE];      /* local tty -> appliance */
3f26098
+
3f26098
+static void
3f26098
+do_rescue (int sock)
3f26098
+{
3f26098
+  size_t rlen = 0;
3f26098
+  size_t wlen = 0;
3f26098
+
3f26098
+  while (sock >= 0 || rlen > 0) {
3f26098
+    struct pollfd fds[3];
3f26098
+    nfds_t nfds = 2;
3f26098
+    int r;
3f26098
+    ssize_t n;
3f26098
+
3f26098
+    fds[0].fd = STDIN_FILENO;
3f26098
+    fds[0].events = 0;
3f26098
+    if (BUFSIZE-wlen > 0)
3f26098
+      fds[0].events = POLLIN;
3f26098
+    fds[0].revents = 0;
3f26098
+
3f26098
+    fds[1].fd = STDOUT_FILENO;
3f26098
+    fds[1].events = 0;
3f26098
+    if (rlen > 0)
3f26098
+      fds[1].events |= POLLOUT;
3f26098
+    fds[1].revents = 0;
3f26098
+
3f26098
+    if (sock >= 0) {
3f26098
+      fds[2].fd = sock;
3f26098
+      fds[2].events = 0;
3f26098
+      if (BUFSIZE-rlen > 0)
3f26098
+        fds[2].events |= POLLIN;
3f26098
+      if (wlen > 0)
3f26098
+        fds[2].events |= POLLOUT;
3f26098
+      fds[2].revents = 0;
3f26098
+      nfds++;
3f26098
+    }
3f26098
+
3f26098
+    r = poll (fds, nfds, -1);
3f26098
+    if (r == -1) {
3f26098
+      if (errno == EINTR || errno == EAGAIN)
3f26098
+        continue;
3f26098
+      perror ("poll");
3f26098
+      return;
3f26098
+    }
3f26098
+
3f26098
+    /* Input from local tty. */
3f26098
+    if ((fds[0].revents & POLLIN) != 0) {
3f26098
+      assert (BUFSIZE-wlen > 0);
3f26098
+      n = read (STDIN_FILENO, wbuf+wlen, BUFSIZE-wlen);
3f26098
+      if (n == -1) {
3f26098
+        if (errno == EINTR || errno == EAGAIN)
3f26098
+          continue;
3f26098
+        perror ("read");
3f26098
+        return;
3f26098
+      }
3f26098
+      if (n == 0) {
3f26098
+        /* We don't expect this to happen.  Maybe the whole tty went away?
3f26098
+         * Anyway, we should exit as soon as possible.
3f26098
+         */
3f26098
+        return;
3f26098
+      }
3f26098
+      if (n > 0)
3f26098
+        wlen += n;
3f26098
+    }
3f26098
+
3f26098
+    /* Log message from appliance. */
3f26098
+    if (nfds > 2 && (fds[2].revents & POLLIN) != 0) {
3f26098
+      assert (BUFSIZE-rlen > 0);
3f26098
+      n = read (sock, rbuf+rlen, BUFSIZE-rlen);
3f26098
+      if (n == -1) {
3f26098
+        if (errno == EINTR || errno == EAGAIN)
3f26098
+          continue;
3f26098
+        if (errno == ECONNRESET)
3f26098
+          goto appliance_closed;
3f26098
+        perror ("read");
3f26098
+        return;
3f26098
+      }
3f26098
+      if (n == 0) {
3f26098
+      appliance_closed:
3f26098
+        sock = -1;
3f26098
+        /* Don't actually close the socket, because it's owned by
3f26098
+         * the guestfs handle.
3f26098
+         */
3f26098
+        continue;
3f26098
+      }
3f26098
+      if (n > 0)
3f26098
+        rlen += n;
3f26098
+    }
3f26098
+
3f26098
+    /* Write log messages to local tty. */
3f26098
+    if ((fds[1].revents & POLLOUT) != 0) {
3f26098
+      assert (rlen > 0);
3f26098
+      n = write (STDOUT_FILENO, rbuf, rlen);
3f26098
+      if (n == -1) {
3f26098
+        perror ("write");
3f26098
+        continue;
3f26098
+      }
3f26098
+      rlen -= n;
3f26098
+      memmove (rbuf, rbuf+n, rlen);
3f26098
+    }
3f26098
+
3f26098
+    /* Write commands to the appliance. */
3f26098
+    if (nfds > 2 && (fds[2].revents & POLLOUT) != 0) {
3f26098
+      assert (wlen > 0);
3f26098
+      n = write (sock, wbuf, wlen);
3f26098
+      if (n == -1) {
3f26098
+        perror ("write");
3f26098
+        continue;
3f26098
+      }
3f26098
+      wlen -= n;
3f26098
+      memmove (wbuf, wbuf+n, wlen);
3f26098
+    }
3f26098
+  }
3f26098
+}
3f26098
+
3f26098
+/* Put the tty in raw mode. */
3f26098
+static void
3f26098
+raw_tty (void)
3f26098
+{
3f26098
+  struct termios termios;
3f26098
+
3f26098
+  if (tcgetattr (STDIN_FILENO, &termios) == -1) {
3f26098
+    perror ("tcgetattr: stdin");
3f26098
+    exit (EXIT_FAILURE);
3f26098
+  }
3f26098
+  cfmakeraw (&termios);
3f26098
+  if (tcsetattr (STDIN_FILENO, TCSANOW, &termios) == -1) {
3f26098
+    perror ("tcsetattr: stdin");
3f26098
+    exit (EXIT_FAILURE);
3f26098
+  }
3f26098
+}
3f26098
+
3f26098
+/* Restore the tty to (presumably) cooked mode as it was when
3f26098
+ * the program was started.
3f26098
+ */
3f26098
+static void
3f26098
+restore_tty (void)
3f26098
+{
3f26098
+  tcsetattr (STDIN_FILENO, TCSANOW, &old_termios);
3f26098
+}
3f26098
+
3f26098
+/* When we get SIGTSTP, switch back to cooked mode. */
3f26098
+static void
3f26098
+tstp_handler (int sig)
3f26098
+{
3f26098
+  restore_tty ();
3f26098
+  signal (SIGTSTP, SIG_DFL);
3f26098
+  raise (SIGTSTP);
3f26098
+}
3f26098
+
3f26098
+/* When we get SIGCONF, switch to raw mode. */
3f26098
+static void
3f26098
+cont_handler (int sig)
3f26098
+{
3f26098
+  raw_tty ();
3f26098
+}
3f26098
+
3f26098
 static void suggest_filesystems (void);
3f26098
 
3f26098
 static int
3f26098
-- 
c4bd84b
2.13.2
3f26098