#include "libslirp.h"
#endif
+#if defined(__OpenBSD__)
+#include <util.h>
+#endif
+
#if defined(CONFIG_VDE)
#include <libvdeplug.h>
#endif
}
#endif
-#if defined(__linux__) || defined(__sun__)
+#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
+ || defined(__NetBSD__) || defined(__OpenBSD__)
typedef struct {
int fd;
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)
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;
}
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;
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