1 .\" SPDX-License-Identifier: BSD-2-Clause
3 .\" Copyright (c) 2018 Gandi
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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.
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
28 .Dd September 23, 2020
34 .Nd make a hard file link
40 .Fn fhlink "fhandle_t *fhp" "const char *to"
42 .Fn fhlinkat "fhandle_t *fhp" "int tofd" "const char *to"
48 atomically creates the specified directory entry (hard link)
50 with the attributes of the underlying object pointed at by
52 If the link is successful: the link count of the underlying object
57 share equal access and rights
65 is not deleted and the link count of the
69 The object pointed at by the
72 must exist for the hard link to
78 must be in the same file system.
82 may not be a directory.
86 system call is equivalent to
88 except in the case where
91 In this case a relative path
93 is interpreted relative to
94 the directory associated with the file descriptor
96 instead of the current working directory.
100 are constructed by a bitwise-inclusive OR of flags from the following
103 .Bl -tag -width indent
104 .It Dv AT_SYMLINK_FOLLOW
107 names a symbolic link, a new link for the target of the symbolic link is
110 Only allow to link to a file which is beneath of the topping directory.
111 See the description of the
116 .It Dv AT_RESOLVE_BENEATH
117 Only walks paths below the topping directory.
118 See the description of the
119 .Dv O_RESOLVE_BENEATH
127 is passed the special value
131 parameter, the current working directory is used for the
138 the behavior is identical to a call to
143 .Dv AT_SYMLINK_FOLLOW
146 names a symbolic link, a new link is created for the symbolic link
155 will fail and no link will be created if:
160 prefix is not a directory.
161 .It Bq Er ENAMETOOLONG
164 exceeded 255 characters,
167 name exceeded 1023 characters.
171 prefix does not exist.
173 The file system containing the file pointed at by
175 does not support links.
177 The link count of the file pointed at by
183 prefix denies search permission.
185 The requested link requires writing in a directory with a mode
186 that denies write permission.
188 Too many symbolic links were encountered in translating one of the pathnames.
190 The file pointed at by
198 The file pointed at by
202 The file pointed at by
204 has its immutable or append-only flag set, see the
206 manual page for more information.
208 The parent directory of the file named by
210 has its immutable flag set.
214 and the file pointed at by
216 are on different file systems.
218 The directory in which the entry for the new link is being placed
219 cannot be extended because there is no space left on the file
220 system containing the directory.
222 The directory in which the entry for the new link
223 is being placed cannot be extended because the
224 user's quota of disk blocks on the file system
225 containing the directory has been exhausted.
227 An I/O error occurred while reading from or writing to
228 the file system to make the directory entry.
230 Corrupted data was detected while reading from the file system.
232 The requested link requires writing in a directory on a read-only file
235 One of the pathnames specified
236 is outside the process's allocated address space.
243 In addition to the errors returned by the
247 system call may fail if:
254 argument does not specify an absolute path and the
258 nor a valid file descriptor open for searching.
262 argument is not valid.
268 argument is not an absolute path and
272 nor a file descriptor associated with a directory.