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