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