From owner-FreeBSD-tech-jp@jp.freebsd.org  Thu Feb 27 05:39:50 1997
Received: by jaz.jp.freebsd.org (8.8.5+2.7Wbeta5/8.7.3) id FAA13373
	Thu, 27 Feb 1997 05:39:50 +0900 (JST)
Received: by jaz.jp.freebsd.org (8.8.5+2.7Wbeta5/8.7.3) with ESMTP id FAA13359
	for <FreeBSD-tech-jp@jp.freebsd.org>; Thu, 27 Feb 1997 05:39:48 +0900 (JST)
Received: from gear.csl.sony.co.jp (gear.csl.sony.co.jp [43.27.98.87]) by widefw.csl.sony.co.jp (8.8.3/3.5Wbeta) with ESMTP id UAA16685 for <FreeBSD-tech-jp@jp.freebsd.org>; Wed, 26 Feb 1997 20:39:42 GMT
Received: from gear.csl.sony.co.jp by gear.csl.sony.co.jp (8.8.4+2.7Wbeta4/2.8Wb)
	id FAA04877; Thu, 27 Feb 1997 05:39:36 +0900 (JST)
From: Noritoshi Demizu (=?ISO-2022-JP?B?GyRCPVA/ZUshPVMbKEI=?=) <demizu@csl.sony.co.jp>
To: FreeBSD-tech-jp@jp.freebsd.org
In-Reply-To: Your message of "Wed, 26 Feb 1997 15:00:27 +0900"
References: <199702260600.PAA02690@penguin.mdc.tijp.ti.com>
X-Mailer: Mew version 1.54 on Emacs 19.28.1, Mule 2.3
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Message-Id: <19970227053935K.demizu@gear.csl.sony.co.jp>
Date: Thu, 27 Feb 1997 05:39:35 +0900
X-Dispatcher: impost version 0.98 (Feb. 11, 1997)
Lines: 37
Reply-To: FreeBSD-tech-jp@jp.freebsd.org
Precedence: bulk
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=19]
X-Sequence: FreeBSD-tech-jp 102
Subject: [FreeBSD-tech-jp 102] Re: jserver patch
Errors-To: owner-FreeBSD-tech-jp@jp.freebsd.org
Sender: owner-FreeBSD-tech-jp@jp.freebsd.org

> $B!VIaDL$N(B UNIX $B$G$O!"(Bfreopen(3) $B$O?7$7$$(B fd $B$r3d$jEv$F$k:]$N5,B'$,!"(B
> open(2)$B$HF1MM(B($B6u$$$F$$$k:G>.?t$r3d$jEv$F$k(B)$B$J$N$KBP$7!"(BFreeBSD $B$G$O(B 
> freopen(3) $B$7$F$b(B fd $B$OJQ$o$i$J$$$h$&$K$7$F$$$k!W(B

$B$^$H$a$k$H!"!VIaJWE*!W$H$$$&4QE@$+$i$O!"(B

   $B!&(B0, 1, 2 (stdin, stdout, stderr) $B$N@h$rJQ99$9$k:]$K$O!"(B
     open(2), close(2) ($B$b$7$/$O(B fopen(3), fclose(3)) $B$N$_$rMQ$$$F!"(B
    $B!X?7$7$$(B fd $B$O6u$$$F$$$k:G>.?t$r3d$jEv$F$k!Y$H$$$&5,B'$K$N$C$H$C$?(B
    $B%3!<%I$r=q$/$N$,NI$$(B

$B$H$$$&$3$H$G$7$g$&$+!#(B


$B0J2<$O$*$^$1$G!"!"!"!"(B

> dup(2) $B$r;H$C$?(B dup2(2) $B$N<BAu$J$i!"$3$s$J46$8$G$9$+(B($BL5J]>Z(B)

maybedup2() $B$8$c$J$/$F$[$s$H$N(B dup2() $B$b4JC1$K=q$1$k$H;W$$$^$9!#(B

	int dup2(int old, int new)
	{
		int fd1, fd2;
	
		fd1 = dup(old);
		if (fd1 < 0)
			return -1;
		if (fd1 == new)
			return new;
		fd2 = dup2(old, new);
		close(fd1);
		return fd2;
	}

$B$A$g$C$H$R$I$$%3!<%I$G$9$,!#(B:-)

	$B=P?eK!=S(B
