Re: bhyve: allow specifiying tty by fd

2014-04-14 Thread Peter Grehan

Hi Roman,


Could it be an additional comma separated option? E.g.:

-l com1,fd=42,sock

or

-l com1,fd=42,tty


 Yes, this is a possibility.

 I'll get your patch in for the tty backend as a start.

later,

Peter.
___
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"


Re: bhyve: allow specifiying tty by fd

2014-04-13 Thread Roman Bogorodskiy
  Peter Grehan wrote:

> Hi Roman,
> 
> >>> bhyve   -s 31,lpc -l com1,fd=19 vm0
> >>
> >>Yes, useful idea, and will become more relevant in the capsicum world
> >> of passing fd's to a sandboxed bhyve.
> >>
> >>Thanks: I'll get this submitted.
> >
> > Hi Peter!
> >
> > Any news on that?
> 
>   I started to do it, and then hesitated bit for two reasons. First, 
> it's useful for all backends, but there still needs to be a type - file 
> descriptors can't be treated as something opaque: there still needs to 
> be knowledge of whether it's a socket, char device, file etc, so the 
> option may need additional information to describe that.

Could it be an additional comma separated option? E.g.:

-l com1,fd=42,sock

or

-l com1,fd=42,tty

etc

>   Also, given that Capsicum wants to pass fd's as parameters, I was 
> wondering if there is a general syntax style for doing this. "fd=%d" 
> seems Ok, though it would be useful if there was something in libutil to 
> parse an option like this if it is the preferred way forward for FreeBSD 
> executables.
> 
>   What do folk think ? Any useful precedents ?

Off the top of my head I cannot recall such an example in the tree.

Roman Bogorodskiy


pgp9zOvIFWBb0.pgp
Description: PGP signature


Re: bhyve: allow specifiying tty by fd

2014-04-09 Thread Peter Grehan

Hi Roman,


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


   Yes, useful idea, and will become more relevant in the capsicum world
of passing fd's to a sandboxed bhyve.

   Thanks: I'll get this submitted.


Hi Peter!

Any news on that?


 I started to do it, and then hesitated bit for two reasons. First, 
it's useful for all backends, but there still needs to be a type - file 
descriptors can't be treated as something opaque: there still needs to 
be knowledge of whether it's a socket, char device, file etc, so the 
option may need additional information to describe that.


 Also, given that Capsicum wants to pass fd's as parameters, I was 
wondering if there is a general syntax style for doing this. "fd=%d" 
seems Ok, though it would be useful if there was something in libutil to 
parse an option like this if it is the preferred way forward for FreeBSD 
executables.


 What do folk think ? Any useful precedents ?

later,

Peter.

___
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"


Re: bhyve: allow specifiying tty by fd

2014-04-09 Thread Roman Bogorodskiy
  Peter Grehan wrote:

> Hi Roman,
> > 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   -s 31,lpc -l com1,fd=19 vm0
> 
>   Yes, useful idea, and will become more relevant in the capsicum world 
> of passing fd's to a sandboxed bhyve.
> 
>   Thanks: I'll get this submitted.

Hi Peter!

Any news on that?

Thanks,

Roman Bogorodskiy


pgpL082wXlZUG.pgp
Description: PGP signature


Re: bhyve: allow specifiying tty by fd

2014-03-06 Thread Peter Grehan

Hi Julian,


and allows fd to be a socket! :-)


 Maybe not initially. There a bunch of code that wants to issue tty 
ioctls on the fd, so the code currently verifies that it is indeed a tty.


later,

Peter.

___
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"


Re: bhyve: allow specifiying tty by fd

2014-03-06 Thread Julian Elischer

On 3/6/14, 10:33 AM, Peter Grehan wrote:
and allows fd to be a socket! :-)

Hi Roman,

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   -s 31,lpc -l com1,fd=19 vm0


 Yes, useful idea, and will become more relevant in the capsicum 
world of passing fd's to a sandboxed bhyve.


 Thanks: I'll get this submitted.

later,

Peter.

___
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"




___
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"


Re: bhyve: allow specifiying tty by fd

2014-03-06 Thread Peter Grehan

Hi Roman,

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   -s 31,lpc -l com1,fd=19 vm0


 Yes, useful idea, and will become more relevant in the capsicum world 
of passing fd's to a sandboxed bhyve.


 Thanks: I'll get this submitted.

later,

Peter.

___
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"


bhyve: allow specifiying tty by fd

2014-03-05 Thread Roman Bogorodskiy
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   -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"