xref: /freebsd/lib/libsys/fhopen.2 (revision 8269e7673cf033aba67dab8264fe719920c70f87)
1*8269e767SBrooks Davis.\"	$NetBSD: fhopen.2,v 1.1 1999/06/30 01:32:15 wrstuden Exp $
2*8269e767SBrooks Davis.\"
3*8269e767SBrooks Davis.\" Copyright (c) 1999 National Aeronautics & Space Administration
4*8269e767SBrooks Davis.\" All rights reserved.
5*8269e767SBrooks Davis.\"
6*8269e767SBrooks Davis.\" This software was written by William Studenmund of the
7*8269e767SBrooks Davis.\" Numerical Aerospace Simulation Facility, NASA Ames Research Center.
8*8269e767SBrooks Davis.\"
9*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without
10*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions
11*8269e767SBrooks Davis.\" are met:
12*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
13*8269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
14*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
15*8269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
16*8269e767SBrooks Davis.\"    documentation and/or other materials provided with the distribution.
17*8269e767SBrooks Davis.\" 3. Neither the name of the National Aeronautics & Space Administration
18*8269e767SBrooks Davis.\"    nor the names of its contributors may be used to endorse or promote
19*8269e767SBrooks Davis.\"    products derived from this software without specific prior written
20*8269e767SBrooks Davis.\"    permission.
21*8269e767SBrooks Davis.\"
22*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE NATIONAL AERONAUTICS & SPACE ADMINISTRATION
23*8269e767SBrooks Davis.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24*8269e767SBrooks Davis.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25*8269e767SBrooks Davis.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ADMINISTRATION OR CONTRIB-
26*8269e767SBrooks Davis.\" UTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27*8269e767SBrooks Davis.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28*8269e767SBrooks Davis.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29*8269e767SBrooks Davis.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30*8269e767SBrooks Davis.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31*8269e767SBrooks Davis.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32*8269e767SBrooks Davis.\" POSSIBILITY OF SUCH DAMAGE.
33*8269e767SBrooks Davis.\"
34*8269e767SBrooks Davis.Dd June 29, 1999
35*8269e767SBrooks Davis.Dt FHOPEN 2
36*8269e767SBrooks Davis.Os
37*8269e767SBrooks Davis.Sh NAME
38*8269e767SBrooks Davis.Nm fhopen ,
39*8269e767SBrooks Davis.Nm fhstat ,
40*8269e767SBrooks Davis.Nm fhstatfs
41*8269e767SBrooks Davis.Nd access file via file handle
42*8269e767SBrooks Davis.Sh LIBRARY
43*8269e767SBrooks Davis.Lb libc
44*8269e767SBrooks Davis.Sh SYNOPSIS
45*8269e767SBrooks Davis.In sys/param.h
46*8269e767SBrooks Davis.In sys/mount.h
47*8269e767SBrooks Davis.In sys/stat.h
48*8269e767SBrooks Davis.Ft int
49*8269e767SBrooks Davis.Fn fhopen "const fhandle_t *fhp" "int flags"
50*8269e767SBrooks Davis.Ft int
51*8269e767SBrooks Davis.Fn fhstat "const fhandle_t *fhp" "struct stat *sb"
52*8269e767SBrooks Davis.Ft int
53*8269e767SBrooks Davis.Fn fhstatfs "const fhandle_t *fhp" "struct statfs *buf"
54*8269e767SBrooks Davis.Sh DESCRIPTION
55*8269e767SBrooks DavisThese system calls provide a means to access a file given the file handle
56*8269e767SBrooks Davis.Fa fhp .
57*8269e767SBrooks DavisAs this method bypasses directory access restrictions, these calls are
58*8269e767SBrooks Davisrestricted to the superuser.
59*8269e767SBrooks Davis.Pp
60*8269e767SBrooks DavisThe
61*8269e767SBrooks Davis.Fn fhopen
62*8269e767SBrooks Davissystem call
63*8269e767SBrooks Davisopens the file referenced by
64*8269e767SBrooks Davis.Fa fhp
65*8269e767SBrooks Davisfor reading and/or writing as specified by the argument
66*8269e767SBrooks Davis.Fa flags
67*8269e767SBrooks Davisand returns the file descriptor to the calling process.
68*8269e767SBrooks DavisThe
69*8269e767SBrooks Davis.Fa flags
70*8269e767SBrooks Davisargument
71*8269e767SBrooks Davisis specified by
72*8269e767SBrooks Davis.Em or Ns 'ing
73*8269e767SBrooks Davistogether the flags used for the
74*8269e767SBrooks Davis.Xr open 2
75*8269e767SBrooks Davissystem call.
76*8269e767SBrooks DavisAll said flags are valid except for
77*8269e767SBrooks Davis.Dv O_CREAT .
78*8269e767SBrooks Davis.Pp
79*8269e767SBrooks DavisThe
80*8269e767SBrooks Davis.Fn fhstat
81*8269e767SBrooks Davisand
82*8269e767SBrooks Davis.Fn fhstatfs
83*8269e767SBrooks Davissystem calls
84*8269e767SBrooks Davisprovide the functionality of the
85*8269e767SBrooks Davis.Xr fstat 2
86*8269e767SBrooks Davisand
87*8269e767SBrooks Davis.Xr fstatfs 2
88*8269e767SBrooks Daviscalls except that they return information for the file referred to by
89*8269e767SBrooks Davis.Fa fhp
90*8269e767SBrooks Davisrather than an open file.
91*8269e767SBrooks Davis.Sh RETURN VALUES
92*8269e767SBrooks DavisUpon successful completion,
93*8269e767SBrooks Davis.Fn fhopen
94*8269e767SBrooks Davisreturns the file descriptor for the opened file;
95*8269e767SBrooks Davisotherwise the value \-1 is returned and the global variable
96*8269e767SBrooks Davis.Va errno
97*8269e767SBrooks Davisis set to indicate the error.
98*8269e767SBrooks Davis.Pp
99*8269e767SBrooks Davis.Rv -std fhstat fhstatfs
100*8269e767SBrooks Davis.Sh ERRORS
101*8269e767SBrooks DavisIn addition to the errors returned by
102*8269e767SBrooks Davis.Xr open 2 ,
103*8269e767SBrooks Davis.Xr fstat 2 ,
104*8269e767SBrooks Davisand
105*8269e767SBrooks Davis.Xr fstatfs 2
106*8269e767SBrooks Davisrespectively,
107*8269e767SBrooks Davis.Fn fhopen ,
108*8269e767SBrooks Davis.Fn fhstat ,
109*8269e767SBrooks Davisand
110*8269e767SBrooks Davis.Fn fhstatfs
111*8269e767SBrooks Daviswill return
112*8269e767SBrooks Davis.Bl -tag -width Er
113*8269e767SBrooks Davis.It Bq Er EINVAL
114*8269e767SBrooks DavisCalling
115*8269e767SBrooks Davis.Fn fhopen
116*8269e767SBrooks Daviswith
117*8269e767SBrooks Davis.Dv O_CREAT
118*8269e767SBrooks Davisset.
119*8269e767SBrooks Davis.It Bq Er ESTALE
120*8269e767SBrooks DavisThe file handle
121*8269e767SBrooks Davis.Fa fhp
122*8269e767SBrooks Davisis no longer valid.
123*8269e767SBrooks Davis.El
124*8269e767SBrooks Davis.Sh SEE ALSO
125*8269e767SBrooks Davis.Xr fstat 2 ,
126*8269e767SBrooks Davis.Xr fstatfs 2 ,
127*8269e767SBrooks Davis.Xr getfh 2 ,
128*8269e767SBrooks Davis.Xr open 2
129*8269e767SBrooks Davis.Sh HISTORY
130*8269e767SBrooks DavisThe
131*8269e767SBrooks Davis.Fn fhopen ,
132*8269e767SBrooks Davis.Fn fhstat ,
133*8269e767SBrooks Davisand
134*8269e767SBrooks Davis.Fn fhstatfs
135*8269e767SBrooks Davissystem calls first appeared in
136*8269e767SBrooks Davis.Nx 1.5
137*8269e767SBrooks Davisand were adapted to
138*8269e767SBrooks Davis.Fx 4.0
139*8269e767SBrooks Davisby
140*8269e767SBrooks Davis.An Alfred Perlstein .
141*8269e767SBrooks Davis.Sh AUTHORS
142*8269e767SBrooks DavisThis manual page was written by
143*8269e767SBrooks Davis.An William Studenmund
144*8269e767SBrooks Davisfor
145*8269e767SBrooks Davis.Nx .
146