xref: /netbsd-src/lib/libc/sys/getfh.2 (revision 23c8222edbfb0f0932d88a8351d3a0cf817dfb9e)
1.\"	$NetBSD: getfh.2,v 1.17 2004/05/13 10:20:58 wiz Exp $
2.\"
3.\" Copyright (c) 1989, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	@(#)getfh.2	8.1 (Berkeley) 6/9/93
31.\"
32.Dd June 9, 1993
33.Dt GETFH 2
34.Os
35.Sh NAME
36.Nm getfh
37.Nd get file handle
38.Sh LIBRARY
39.Lb libc
40.Sh SYNOPSIS
41.In sys/types.h
42.In sys/mount.h
43.Ft int
44.Fn getfh "const char *path" "fhandle_t *fhp"
45.Sh DESCRIPTION
46.Fn getfh
47returns a file handle for the specified file or directory
48in the file handle pointed to by
49.Fa fhp .
50This system call is restricted to the superuser.
51.Sh RETURN VALUES
52Upon successful completion, a value of 0 is returned.
53Otherwise, \-1 is returned and the global variable
54.Va errno
55is set to indicate the error.
56.Sh ERRORS
57.Fn getfh
58fails if one or more of the following are true:
59.Bl -tag -width Er
60.It Bq Er ENOTDIR
61A component of the path prefix of
62.Fa path
63is not a directory.
64.It Bq Er ENAMETOOLONG
65The length of a component of
66.Fa path
67exceeds
68.Dv {NAME_MAX}
69characters, or the length of
70.Fa path
71exceeds
72.Dv {PATH_MAX}
73characters.
74.It Bq Er ENOENT
75The file referred to by
76.Fa path
77does not exist.
78.It Bq Er EACCES
79Search permission is denied for a component of the path prefix of
80.Fa path .
81.It Bq Er ELOOP
82Too many symbolic links were encountered in translating
83.Fa path .
84.It Bq Er EFAULT
85.Fa fhp
86points to an invalid address.
87.It Bq Er EIO
88An
89.Tn I/O
90error occurred while reading from or writing to the file system.
91.El
92.Sh HISTORY
93The
94.Fn getfh
95function
96first appeared in
97.Bx 4.4 .
98