.\" Copyright (c) 1996 .\" Mike Pritchard . All rights reserved. .\" .\" Copyright (c) 1992, 1993, 1994 .\" The Regents of the University of California. All rights reserved. .\" All rights reserved. .\" .\" This code is derived from software donated to Berkeley by .\" Jan-Simon Pendry. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" %FreeBSD: src/share/man/man5/fdescfs.5,v 1.14 2004/07/02 19:55:26 ru Exp % .\" .\" $FreeBSD$ .\" WORD: file descriptor ファイル記述子 .\" WORD: augment (union マウントによる)重ね合わせ .\" .Dd December 14, 1996 .Dt FDESCFS 5 .Os .Sh 名称 .Nm fdescfs .Nd ファイル記述子ファイルシステム .Sh 書式 .Bd -literal fdescfs /dev/fd fdescfs rw 0 0 .Ed .Sh 解説 ファイル記述子ファイルシステム、別名 .Nm は、プロセス毎のファイル記述子の名前空間をグローバルなファイルシステムの 名前空間からアクセスする機能を提供します。 通常のマウントポイントは .Pa /dev/fd です。 .Pp .Pp ファイルシステムの中身は、番号で表したファイルのリストとして見えます。 これらのファイルは、ディレクトリを読むプロセスが現在オープンしている ファイルに対応しています。 .Pa /dev/fd/0 から .Pa /dev/fd/# までのファイルは記述子への参照であり、 ファイルシステムを通じてアクセスすることができます。 ファイル記述子がオープンされていて、ファイルをオープンしたときのモードが 既存の記述子のモードのサブセットである場合は、システムコール呼び出し .Bd -literal -offset indent fd = open("/dev/fd/0", mode); .Ed .Pp と、システムコール呼び出し .Bd -literal -offset indent fd = fcntl(0, F_DUPFD, 0); .Ed .Pp は等価です。 .Pp .Xr open 2 呼び出し時のフラグは .Dv O_RDONLY , .Dv O_WRONLY および .Dv O_RDWR 以外は無視されます。 .Sh 関連ファイル .Bl -tag -width /dev/stderr -compact .It Pa /dev/fd/# .El .Sh 関連項目 .Xr tty 4 , .Xr mount_devfs 8 , .Xr mount_fdescfs 8 , .Sh 歴史 .Nm ファイルシステムは .Bx 4.4 で最初に登場しました。 .Nm マニュアルページは .Fx 2.2 で最初に登場しました。 .Sh 作者 .An -nosplit .Nm マニュアルページは .An Mike Pritchard Aq mpp@FreeBSD.org によって書かれたもので、 .An Jan-Simon Pendry による .Xr mount_fdescfs 8 マニュアルページに基づいています。