1.\" SPDX-License-Identifier: BSD-2-Clause 2.\" 3.\" Copyright (c) 2018 Gandi 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" 26.Dd November 30, 2022 27.Dt FHREADLINK 2 28.Os 29.Sh NAME 30.Nm fhreadlink 31.Nd read value of a symbolic link 32.Sh LIBRARY 33.Lb libc 34.Sh SYNOPSIS 35.In sys/param.h 36.In sys/mount.h 37.Ft int 38.Fn fhreadlink "fhandle_t *fhp" "char *buf" "size_t bufsize" 39.Sh DESCRIPTION 40The 41.Fn fhreadlink 42system call 43places the contents of the symbolic link 44.Fa fhp 45in the buffer 46.Fa buf , 47which has size 48.Fa bufsiz . 49The 50.Fn fhreadlink 51system call does not append a 52.Dv NUL 53character to 54.Fa buf . 55.Pp 56.Sh RETURN VALUES 57The call returns the count of characters placed in the buffer 58if it succeeds, or a \-1 if an error occurs, placing the error 59code in the global variable 60.Va errno . 61.Sh ERRORS 62The 63.Fn readlink 64system call 65will fail if: 66.Bl -tag -width Er 67.It Bq Er ENOENT 68The named file does not exist. 69.It Bq Er ELOOP 70Too many symbolic links were encountered in translating the file handle 71.Fa fhp . 72.It Bq Er EINVAL 73The named file is not a symbolic link. 74.It Bq Er EIO 75An I/O error occurred while reading from the file system. 76.It Bq Er EINTEGRITY 77Corrupted data was detected while reading from the file system. 78.It Bq Er EFAULT 79The 80.Fa buf 81argument 82extends outside the process's allocated address space. 83.It Bq Er ESTALE 84The file handle 85.Fa fhp 86is no longer valid 87.El 88.Sh SEE ALSO 89.Xr fhstat 2 , 90.Xr fhlink 2 , 91.Sh HISTORY 92The 93.Fn fhreadlink 94system call first appeared in 95.Fx 12.1 . 96