*BSD News Article 91363


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!news.sprintlink.net!news-peer.sprintlink.net!uunet!in3.uu.net!132.205.106.4!newsflash.concordia.ca!sunqbc.risq.net!news1.bellglobal.com!sympatico.ca!not-for-mail
From: gbuchanan@on.sympatico.ca (Gardner Buchanan)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: dup3() - potential useful feature or silly hack?  You decide.
Date: 19 Mar 1997 00:15:49 GMT
Organization: Sympatico
Lines: 27
Message-ID: <5gnb7l$ei4$1@news1.sympatico.ca>
References: <332EDBFB.2781E494@FreeBSD.org>
NNTP-Posting-Host: ppp1864.on.sympatico.ca
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Newsreader: knews 0.9.7
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:37263

In article <332EDBFB.2781E494@freebsd.org>,
	"Jordan K. Hubbard" <jkh@FreeBSD.org> writes:
> 
> The system call:
> 
>      int
>      dup3(int oldd, pid_t tpid, int newd)
> 
>      In dup3(), a target process ID and the value of the new
>      descriptor newd is specified in the context of that process.  If
>      this descriptor is currently assigned to a valid file, then it
>      will be returned as a new file descriptor in the current process
>      context, otherwise -1 is returned.  If the returned file
>      descriptor is not needed then it should be closed.  The primary
>      purpose of dup3() is to allow "splicing" of I/O in
>      already-running processes.
> 

Neat.  I bet your right about security holes though.
Of course _cooperating_ process are supposed to use
send/recvmsg() to fling file descriptors around.

I thing I'm in the 'hack' camp FWIW.

============================================
Gardner Buchanan    <gbuchanan@sympatico.ca>
Ottawa, ON