*BSD News Article 13139


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!network.ucsd.edu!usc!zaphod.mps.ohio-state.edu!menudo.uh.edu!uuneo!sugar!peter
From: peter@NeoSoft.com (Peter da Silva)
Subject: Re: VM problems w/unlimited memory?
Organization: NeoSoft Communications Services -- (713) 684-5900
Date: Sun, 21 Mar 1993 12:32:44 GMT
Message-ID: <C48o6L.IJ1@sugar.neosoft.com>
References: <1993Mar18.183443.6397@fcom.cc.utah.edu> <1oaudnINNj1a@usenet.INS.CWRU.Edu> <1993Mar20.235246.1980@fcom.cc.utah.edu>
Lines: 27

In article <1993Mar20.235246.1980@fcom.cc.utah.edu> terry@cs.weber.edu (A Wizard of Earth C) writes:
> 	"fd 3 in use:  all future references assumed to be 19"

foo -f 3 blah 3<&/dev/frobozz

There's a solution, though:

	if(fd user requested is in use by me) {
		dup2(fd, unused_fd);
		close(fd);
		switch to using unused_fd myself;
	}

I'm not sure how you'd do that under stdio, though, unless you made illicit
use of the file descriptors:

#ifdef SYSV_STDIO
#define fdreopen(fp, fd) ((fp)->__file=(fd))
#endif

My BSD system is sitting on the shelf right now, or I'd check if this was
the right macro there...
-- 
Peter da Silva.  <peter@sugar.neosoft.com>.
 `-_-'   Oletko halannut suttasi tänään?
  'U`    
Tarjoilija, tämä ateria elää vielä.