From 9b67fde0e2e09add8c73338d25e892568284e1a6 Mon Sep 17 00:00:00 2001 From: pooka Date: Fri, 24 Feb 2006 12:47:18 +0000 Subject: [PATCH] document fdclone --- share/man/man9/Makefile | 3 ++- share/man/man9/filedesc.9 | 22 ++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 5c7258b2dec0..7a833dd5a295 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.191 2006/02/12 23:16:03 macallan Exp $ +# $NetBSD: Makefile,v 1.192 2006/02/24 12:47:18 pooka Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -203,6 +203,7 @@ MLINKS+=filedesc.9 falloc.9 \ filedesc.9 fdavail.9 \ filedesc.9 fdcheckstd.9 \ filedesc.9 fdclear.9 \ + filedesc.9 fdclone.9 \ filedesc.9 fdcloseexec.9 \ filedesc.9 fdcopy.9 \ filedesc.9 fdexpand.9 \ diff --git a/share/man/man9/filedesc.9 b/share/man/man9/filedesc.9 index f1b3885b3ab0..8a9f08fad8a5 100644 --- a/share/man/man9/filedesc.9 +++ b/share/man/man9/filedesc.9 @@ -1,4 +1,4 @@ -.\" $NetBSD: filedesc.9,v 1.9 2006/01/29 18:08:54 kleink Exp $ +.\" $NetBSD: filedesc.9,v 1.10 2006/02/24 12:47:18 pooka Exp $ .\" .\" Copyright (c) 2002, 2005, 2006 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -34,7 +34,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 29, 2006 +.Dd February 24, 2006 .Dt FILEDESC 9 .Os .Sh NAME @@ -73,6 +73,8 @@ .Fn fdcheckstd "struct lwp *l" .Ft void .Fn fdclear "struct lwp *l" +.Ft int +.Fn fdclone "struct lwp *l" "struct file *fp" "int fd" "int flag" "const struct fileops *fops" "void *data" .Ft void .Fn fdcloseexec "struct lwp *l" .Ft struct filedesc * @@ -97,8 +99,8 @@ These file descriptors represent underlying objects supported by the kernel and are created by system calls specific to the type of object. In .Nx , -three type of objects can be represented by file descriptors: data -files, pipes, and sockets. +six types of objects can be represented by file descriptors: data +files, pipes, sockets, event queues, crypto and miscellaneous. .Pp The kernel maintains a descriptor table for each process which is used to translate the external representation of a file descriptor into an @@ -218,6 +220,18 @@ to initialise a new file descriptor table to replace the old file descriptor table and invoking .Fn fdfree to release the old one. +.It Fn fdclone "l" "fp" "fd" "flag" "fops" "data" +This function is meant to be used by devices which allocate a file +entry upon open. +.Fn fdclone +fills +.Fa fp +with the given parameters. +It always returns the in-kernel errno value +.Er EMOVEFD , +which is meant to be returned from the device open routine. +This special return value is interpreted by the caller of the device +open routine. .It Fn fdcloseexec "l" Close any files for process .Fa p