From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 17 18:47:14 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA6AD16A47C for ; Wed, 17 Jan 2007 18:47:14 +0000 (UTC) (envelope-from mwm-keyword-freebsdhackers2.e313df@mired.org) Received: from mired.org (vpn.mired.org [66.92.153.74]) by mx1.freebsd.org (Postfix) with SMTP id 6FBB013C465 for ; Wed, 17 Jan 2007 18:47:14 +0000 (UTC) (envelope-from mwm-keyword-freebsdhackers2.e313df@mired.org) Received: (qmail 49366 invoked by uid 1001); 17 Jan 2007 18:47:50 -0000 Received: by bhuda.mired.org (tmda-sendmail, from uid 1001); Wed, 17 Jan 2007 13:47:50 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17838.28502.527695.168624@bhuda.mired.org> Date: Wed, 17 Jan 2007 13:47:50 -0500 To: "Kailas Ramasamy" In-Reply-To: References: <17837.25293.686122.147525@bhuda.mired.org> <17837.36471.343582.464631@bhuda.mired.org> X-Mailer: VM 7.17 under 21.4 (patch 19) "Constant Variable" XEmacs Lucid X-Primary-Address: mwm@mired.org X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`; h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) From: Mike Meyer Cc: freebsd-hackers@freebsd.org Subject: Re: Bridging console port to a telnet session X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jan 2007 18:47:14 -0000 In , Kailas Ramasamy typed: > Hi Mike, > I read through fork() and exec() man pages but I couldn't find anything > related to > this. Basically, I want to launch a telnet session from a process and pass > in > /dev/console as stdin and stdout. Well, you don't really need fork(), though fork() follows exec() so often than some OS's combine them into a single call. And I just noticed that if you do "man exec", you get the shell's page - you want exec(3), to get the C calls. Anyway, the sequence is: Use open() to get an fd pointing at /dev/console. Use dup2() to copy that fd to stdin and stdout (and probably stderr). Use an exec() function to launch telnet. Thanks > Kailas > > On 1/16/07, Mike Meyer wrote: > > > > In , Kailas > > Ramasamy typed: > > > Hi Mike, > > > Yes, that what I am planing but I want to do this dynamically. Do you > > know > > > how to launch a > > > telnet session from a process?. How do I pass stdin and stdout to the > > telnet > > > from a process?. > > > > See the fork() and exec() man pages. > > > > > > > > > > On 1/16/07, Mike Meyer wrote: > > > > > > > > In , > > Kailas > > > > Ramasamy typed: > > > > > Hi, > > > > > Within a FreeBSD system, I want to telnet to another system and > > bridge > > > > that > > > > > session to the > > > > > console port so that when an user connects to the system via console > > > > port, > > > > > it is automatically > > > > > redirected to other system for I have already established a telnet > > > > session. > > > > > > > > What's wrong with simply leaving a telnet session running on the > > > > console, maybe with some support to relaunch it should it ever exit? > > > > > > > > > > > -- > > > > Mike Meyer > > > > http://www.mired.org/consulting.html > > > > Independent Network/Unix/Perforce consultant, email for more > > information. > > > > > > > _______________________________________________ > > > freebsd-hackers@freebsd.org mailing list > > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > > To unsubscribe, send any mail to " > > freebsd-hackers-unsubscribe@freebsd.org" > > > > > > > -- > > Mike Meyer > > http://www.mired.org/consulting.html > > Independent Network/Unix/Perforce consultant, email for more information. > > > Hi Mike,
I read through fork() and exec() man pages but I couldn't find anything related to
this. Basically, I want to launch a telnet session from a process and pass in
/dev/console as stdin and stdout.
>
Thanks
Kailas

On 1/16/07, Mike Meyer <mwm@mired.org> wrote:
> In <ecd0bee40701161732v26112f24o2d8323c2777d2f7@mail.gmail.com>, Kailas Ramasamy <kailasr@gmail.com > > typed:
> Hi Mike,
> Yes, that what I am planing but I want to do this dynamically. Do you know
> how to launch a
> telnet session from a process?. How do I pass stdin and stdout to the telnet >
> from a process?.

See the fork() and exec() man pages.

        <mike


> On 1/16/07, Mike Meyer <mwm@mired.org> wrote:
> >
> > In < > ecd0bee40701161503k385819ddgba5562e137630617@mail.gmail.com>, Kailas
> > Ramasamy <kailasr@gmail.com > > typed:
> > > Hi,
> > > Within a FreeBSD system, I want to telnet to another system and bridge
> > that
> > > session to the
> > > console port so that when an user connects to the system via console >
> > port,
> > > it is automatically
> > > redirected to other system for I have already established a telnet
> > session.
> >
> > What's wrong with simply leaving a telnet session running on the >
> > console, maybe with some support to relaunch it should it ever exit?
> >
> >         <mike
> > --
> > Mike Meyer <mwm@mired.org> >
> > http://www.mired.org/consulting.html
> > Independent Network/Unix/Perforce consultant, email for more information.
> >
> _______________________________________________ >
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>

--
Mike Meyer < > mwm@mired.org>              http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
>
-- Mike Meyer http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information.