1.\" $OpenBSD: getfh.2,v 1.14 2007/05/31 19:19:32 jmc 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 $Mdocdate: May 31 2007 $ 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 47.Fa path 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 ENOTDIR 61A component of the path prefix of 62.Fa path 63is not a directory. 64.It Bq 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 ENOENT 75The file referred to by 76.Fa path 77does not exist. 78.It Bq EACCES 79Search permission is denied for a component of the path prefix of 80.Fa path . 81.It Bq ELOOP 82Too many symbolic links were encountered in translating 83.Fa path . 84.It Bq EPERM 85The effective user ID is not the superuser. 86.It Bq EFAULT 87.Fa fhp 88or 89.Fa path 90points to an invalid address. 91.It Bq EIO 92An 93.Tn I/O 94error occurred while reading from or writing to the file system. 95.It Bq EINVAL 96A portion of 97.Fa path 98refers to a remote file system. 99.It Bq EOPNOTSUPP 100A portion of 101.Fa path 102refers to a remote file system. 103.El 104.Sh SEE ALSO 105.Xr fhstat 2 106.Sh HISTORY 107The 108.Fn getfh 109function first appeared in 110.Bx 4.4 . 111