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.\" $FreeBSD$ 27.\" 28.Dd November 29, 2018 29.Dt FHREADLINK 2 30.Os 31.Sh NAME 32.Nm fhreadlink 33.Nd read value of a symbolic link 34.Sh LIBRARY 35.Lb libc 36.Sh SYNOPSIS 37.In sys/param.h 38.In sys/mount.h 39.Ft int 40.Fn fhreadlink "fhandle_t *fhp" "char *buf" "size_t bufsize" 41.Fc 42.Sh DESCRIPTION 43The 44.Fn fhreadlink 45system call 46places the contents of the symbolic link 47.Fa fhp 48in the buffer 49.Fa buf , 50which has size 51.Fa bufsiz . 52The 53.Fn fhreadlink 54system call does not append a 55.Dv NUL 56character to 57.Fa buf . 58.Pp 59.Sh RETURN VALUES 60The call returns the count of characters placed in the buffer 61if it succeeds, or a \-1 if an error occurs, placing the error 62code in the global variable 63.Va errno . 64.Sh ERRORS 65The 66.Fn readlink 67system call 68will fail if: 69.Bl -tag -width Er 70.It Bq Er ENOENT 71The named file does not exist. 72.It Bq Er ELOOP 73Too many symbolic links were encountered in translating the file handle 74.Fa fhp . 75.It Bq Er EINVAL 76The named file is not a symbolic link. 77.It Bq Er EIO 78An I/O error occurred while reading from the file system. 79.It Bq Er EFAULT 80The 81.Fa buf 82argument 83extends outside the process's allocated address space. 84.It Bq Er ESTALE 85The file handle 86.Fa fhp 87is no longer valid 88.El 89.El 90.Sh SEE ALSO 91.Xr fhstat 2 , 92.Xr fhlink 2 , 93