1.\" $OpenBSD: getfh.2,v 1.20 2022/07/30 07:19:30 jsg 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: July 30 2022 $ 34.Dt GETFH 2 35.Os 36.Sh NAME 37.Nm getfh 38.Nd get file handle 39.Sh SYNOPSIS 40.In sys/types.h 41.In 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 52.Rv -std 53.Sh ERRORS 54.Fn getfh 55fails if one or more of the following are true: 56.Bl -tag -width Er 57.It Bq Er ENOTDIR 58A component of the path prefix of 59.Fa path 60is not a directory. 61.It Bq Er ENAMETOOLONG 62A component of a pathname exceeded 63.Dv NAME_MAX 64characters, or an entire pathname (including the terminating NUL) 65exceeded 66.Dv PATH_MAX 67bytes. 68.It Bq Er ENOENT 69The file referred to by 70.Fa path 71does not exist. 72.It Bq Er EACCES 73Search permission is denied for a component of the path prefix of 74.Fa path . 75.It Bq Er ELOOP 76Too many symbolic links were encountered in translating 77.Fa path . 78.It Bq Er EPERM 79The effective user ID is not the superuser. 80.It Bq Er EFAULT 81.Fa fhp 82or 83.Fa path 84points to an invalid address. 85.It Bq Er EIO 86An I/O error occurred while reading from or writing to the file system. 87.It Bq Er EINVAL 88A portion of 89.Fa path 90refers to a remote file system. 91.It Bq Er EOPNOTSUPP 92A portion of 93.Fa path 94refers to a remote file system. 95.El 96.Sh SEE ALSO 97.Xr fhstat 2 98.Sh HISTORY 99The 100.Fn getfh 101function first appeared in 102.Bx 4.3 Reno . 103