xref: /freebsd/lib/libsys/fhreadlink.2 (revision 6e1fc0118033f42b7c0d3623c8f67a89ebecabb2)
18269e767SBrooks Davis.\" SPDX-License-Identifier: BSD-2-Clause
28269e767SBrooks Davis.\"
38269e767SBrooks Davis.\" Copyright (c) 2018 Gandi
48269e767SBrooks Davis.\"
58269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without
68269e767SBrooks Davis.\" modification, are permitted provided that the following conditions
78269e767SBrooks Davis.\" are met:
88269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
98269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
108269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
118269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
128269e767SBrooks Davis.\"    documentation and/or other materials provided with the distribution.
138269e767SBrooks Davis.\"
148269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
158269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
168269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
178269e767SBrooks Davis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
188269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
198269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
208269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
218269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
228269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
238269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
248269e767SBrooks Davis.\" SUCH DAMAGE.
258269e767SBrooks Davis.\"
268269e767SBrooks Davis.Dd November 30, 2022
278269e767SBrooks Davis.Dt FHREADLINK 2
288269e767SBrooks Davis.Os
298269e767SBrooks Davis.Sh NAME
308269e767SBrooks Davis.Nm fhreadlink
318269e767SBrooks Davis.Nd read value of a symbolic link
328269e767SBrooks Davis.Sh LIBRARY
338269e767SBrooks Davis.Lb libc
348269e767SBrooks Davis.Sh SYNOPSIS
358269e767SBrooks Davis.In sys/param.h
368269e767SBrooks Davis.In sys/mount.h
378269e767SBrooks Davis.Ft int
388269e767SBrooks Davis.Fn fhreadlink "fhandle_t *fhp" "char *buf" "size_t bufsize"
398269e767SBrooks Davis.Sh DESCRIPTION
408269e767SBrooks DavisThe
418269e767SBrooks Davis.Fn fhreadlink
428269e767SBrooks Davissystem call
438269e767SBrooks Davisplaces the contents of the symbolic link
448269e767SBrooks Davis.Fa fhp
458269e767SBrooks Davisin the buffer
468269e767SBrooks Davis.Fa buf ,
478269e767SBrooks Daviswhich has size
488269e767SBrooks Davis.Fa bufsiz .
498269e767SBrooks DavisThe
508269e767SBrooks Davis.Fn fhreadlink
518269e767SBrooks Davissystem call does not append a
528269e767SBrooks Davis.Dv NUL
538269e767SBrooks Davischaracter to
548269e767SBrooks Davis.Fa buf .
558269e767SBrooks Davis.Pp
568269e767SBrooks Davis.Sh RETURN VALUES
578269e767SBrooks DavisThe call returns the count of characters placed in the buffer
588269e767SBrooks Davisif it succeeds, or a \-1 if an error occurs, placing the error
598269e767SBrooks Daviscode in the global variable
608269e767SBrooks Davis.Va errno .
618269e767SBrooks Davis.Sh ERRORS
628269e767SBrooks DavisThe
638269e767SBrooks Davis.Fn readlink
648269e767SBrooks Davissystem call
658269e767SBrooks Daviswill fail if:
668269e767SBrooks Davis.Bl -tag -width Er
678269e767SBrooks Davis.It Bq Er ENOENT
688269e767SBrooks DavisThe named file does not exist.
698269e767SBrooks Davis.It Bq Er ELOOP
708269e767SBrooks DavisToo many symbolic links were encountered in translating the file handle
718269e767SBrooks Davis.Fa fhp .
728269e767SBrooks Davis.It Bq Er EINVAL
738269e767SBrooks DavisThe named file is not a symbolic link.
748269e767SBrooks Davis.It Bq Er EIO
758269e767SBrooks DavisAn I/O error occurred while reading from the file system.
768269e767SBrooks Davis.It Bq Er EINTEGRITY
778269e767SBrooks DavisCorrupted data was detected while reading from the file system.
788269e767SBrooks Davis.It Bq Er EFAULT
798269e767SBrooks DavisThe
808269e767SBrooks Davis.Fa buf
818269e767SBrooks Davisargument
828269e767SBrooks Davisextends outside the process's allocated address space.
838269e767SBrooks Davis.It Bq Er ESTALE
848269e767SBrooks DavisThe file handle
858269e767SBrooks Davis.Fa fhp
868269e767SBrooks Davisis no longer valid
878269e767SBrooks Davis.El
888269e767SBrooks Davis.Sh SEE ALSO
898269e767SBrooks Davis.Xr fhlink 2 ,
90*6e1fc011SGraham Percival.Xr fhstat 2
918269e767SBrooks Davis.Sh HISTORY
928269e767SBrooks DavisThe
938269e767SBrooks Davis.Fn fhreadlink
948269e767SBrooks Davissystem call first appeared in
958269e767SBrooks Davis.Fx 12.1 .
96