qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] new feature: attach a process to emulated serial port


From: Johannes Martin
Subject: Re: [Qemu-devel] new feature: attach a process to emulated serial port
Date: Mon, 11 Oct 2004 22:32:29 +0200 (CEST)

Hi,

wow - I didn't think my patch would cause so much controversy :)

On Mon, 11 Oct 2004, Derek Fawcus wrote:
> > The attached patch adds another variety of the -serial and -monitor
> > options. You can now use
> >         -serial "exec:any shell command"
> > to redirect the input/output of named shell command to the guest's serial
> > port.
>
> Hmm.  How about simply using FIFO's instead,  then one doesn't have any
> issues with fork/system/etc
>
> i.e. add options of -serialin <path> -serialout <path> and have -serial <path>
> set both of the above.  Then one can simply do:
>
> mkfifo /tmp/serin /tmp/serout
> anycmd < /tmp/serout > /tmp/serin &
> qemu ... -serialin /tmp/serin -serialout /tmp/serialout
Actually, that's kind of what I tried before (-serial stdio, with
stdin/stdout redirected to a pipe). However, some programs don't like
that. Most importantly, slirp doesn't work with it - it seems to expect a
real tty.

I like my solution because
1. we don't need another command line argument but only extend an existing
   one
2. we don't create another library dependency (forkpty is declared in
   pty.h just as openpty is which we use for -serial pty)
3. I don't need to bother about communicating pty (or pipe) names between
   processes
4. programs like slirp and pppd work just fine with this approach


On Mon, 11 Oct 2004, André Braga wrote:
> That would make this feature available only on operating systems that
> support user-created named pipes. IOW, named pipes do exist on Windows,
> but they're not easy to access by the user.
>
> Forking is a more universal approach, as I see it.
Sorry if I have to disappoint: I'm not sure whether the forkpty() call is
available in Windoze. The -serial pty code is disabled for a Windows
compile, so I did the same for my -serial exec code. If there's a windows
guru out there who knows whether ptys are emulated in cygwin maybe you can
test whether it will work in windoze as well.

        Johannes




reply via email to

[Prev in Thread] Current Thread [Next in Thread]