Hi,

Currently bhyve(8) allows to specify either stdio or device path as a
TTY device. However, it could be useful to specify a TTY device by file
descriptor, e.g. when bhyve is being executed in an automated way by 
other application, so a result of openpty(3) could be passed to it.

Attached a poc patch for that. It allows to specify fd this way:

bhyve <snip>  -s 31,lpc -l com1,fd=19 vm0

Roman Bogorodskiy
Index: bhyve.8
===================================================================
--- bhyve.8	(revision 262780)
+++ bhyve.8	(working copy)
@@ -184,6 +184,8 @@
 the bhyve process.
 .It Pa /dev/xxx
 Use the host TTY device for serial port I/O.
+.It Li fd=N
+Use a specified file descriptor of the TTY device.
 .El
 .Pp
 Pass-through devices:
Index: uart_emul.c
===================================================================
--- uart_emul.c	(revision 262780)
+++ uart_emul.c	(working copy)
@@ -585,7 +585,11 @@
 
 	retval = -1;
 
-	fd = open(opts, O_RDWR);
+	if (!strncmp(opts, "fd=", 3)) {
+		fd = atoi(opts+3);
+	} else {
+		fd = open(opts, O_RDWR);
+	}
 	if (fd > 0 && isatty(fd)) {
 		sc->tty.fd = fd;
 		sc->tty.opened = true;
_______________________________________________
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"

Reply via email to