qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5079] Enable pty/tty functions for BSDs too (initial patch from Xen)
Date: Sun, 24 Aug 2008 10:34:20 +0000	[thread overview]
Message-ID: <E1KXCvM-0001Th-E7@cvs.savannah.gnu.org> (raw)

Revision: 5079
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5079
Author:   blueswir1
Date:     2008-08-24 10:34:20 +0000 (Sun, 24 Aug 2008)

Log Message:
-----------
Enable pty/tty functions for BSDs too (initial patch from Xen)

Modified Paths:
--------------
    trunk/vl.c

Modified: trunk/vl.c
===================================================================
--- trunk/vl.c	2008-08-24 10:30:33 UTC (rev 5078)
+++ trunk/vl.c	2008-08-24 10:34:20 UTC (rev 5079)
@@ -109,6 +109,10 @@
 #include "libslirp.h"
 #endif
 
+#if defined(__OpenBSD__)
+#include <util.h>
+#endif
+
 #if defined(CONFIG_VDE)
 #include <libvdeplug.h>
 #endif
@@ -2465,7 +2469,8 @@
 }
 #endif
 
-#if defined(__linux__) || defined(__sun__)
+#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
+    || defined(__NetBSD__) || defined(__OpenBSD__)
 
 typedef struct {
     int fd;
@@ -2593,6 +2598,13 @@
     PtyCharDriver *s;
     struct termios tty;
     int slave_fd;
+#if defined(__OpenBSD__)
+    char pty_name[PATH_MAX];
+#define q_ptsname(x) pty_name
+#else
+    char *pty_name = NULL;
+#define q_ptsname(x) ptsname(x)
+#endif
 
     chr = qemu_mallocz(sizeof(CharDriverState));
     if (!chr)
@@ -2603,7 +2615,7 @@
         return NULL;
     }
 
-    if (openpty(&s->fd, &slave_fd, NULL, NULL, NULL) < 0) {
+    if (openpty(&s->fd, &slave_fd, pty_name, NULL, NULL) < 0) {
         return NULL;
     }
 
@@ -2612,7 +2624,7 @@
     tcsetattr(slave_fd, TCSAFLUSH, &tty);
     close(slave_fd);
 
-    fprintf(stderr, "char device redirected to %s\n", ptsname(s->fd));
+    fprintf(stderr, "char device redirected to %s\n", q_ptsname(s->fd));
 
     chr->opaque = s;
     chr->chr_write = pty_chr_write;
@@ -3819,7 +3831,8 @@
         return qemu_chr_open_pp(filename);
     } else
 #endif
-#if defined(__linux__) || defined(__sun__)
+#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
+    || defined(__NetBSD__) || defined(__OpenBSD__)
     if (strstart(filename, "/dev/", NULL)) {
         return qemu_chr_open_tty(filename);
     } else

                 reply	other threads:[~2008-08-24 10:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1KXCvM-0001Th-E7@cvs.savannah.gnu.org \
    --to=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).