Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libc/sys/link.2
Show All 22 Lines | |||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" @(#)link.2 8.3 (Berkeley) 1/12/94 | .\" @(#)link.2 8.3 (Berkeley) 1/12/94 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd October 20, 2018 | .Dd November 11, 2018 | ||||
.Dt LINK 2 | .Dt LINK 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm link , | .Nm link , | ||||
.Nm linkat | .Nm linkat | ||||
.Nd make a hard file link | .Nd make a hard file link | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libc | .Lb libc | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
.In fcntl.h : | .In fcntl.h : | ||||
.Bl -tag -width indent | .Bl -tag -width indent | ||||
.It Dv AT_SYMLINK_FOLLOW | .It Dv AT_SYMLINK_FOLLOW | ||||
If | If | ||||
.Fa name1 | .Fa name1 | ||||
names a symbolic link, a new link for the target of the symbolic link is | names a symbolic link, a new link for the target of the symbolic link is | ||||
created. | created. | ||||
.It Dv AT_BENEATH | .It Dv AT_BENEATH | ||||
Only allow to link to a file which is beneath of the starting directory. | Only allow to link to a file which is beneath of the topping directory. | ||||
See the description of the | |||||
.Dv O_BENEATH | |||||
flag in the | |||||
.Xr open 2 | |||||
manual page. | |||||
.El | .El | ||||
.Pp | .Pp | ||||
If | If | ||||
.Fn linkat | .Fn linkat | ||||
is passed the special value | is passed the special value | ||||
.Dv AT_FDCWD | .Dv AT_FDCWD | ||||
in the | in the | ||||
.Fa fd1 | .Fa fd1 | ||||
▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | |||||
argument is not an absolute path and | argument is not an absolute path and | ||||
.Fa fd1 | .Fa fd1 | ||||
or | or | ||||
.Fa fd2 , | .Fa fd2 , | ||||
respectively, is neither | respectively, is neither | ||||
.Dv AT_FDCWD | .Dv AT_FDCWD | ||||
nor a file descriptor associated with a directory. | nor a file descriptor associated with a directory. | ||||
.It Bq Er ENOTCAPABLE | .It Bq Er ENOTCAPABLE | ||||
The | |||||
.Dv AT_BENEATH | |||||
flag was specified but | |||||
.Fa name1 | .Fa name1 | ||||
is not strictly relative to the starting directory. | is not strictly relative to the starting directory. | ||||
For example, | For example, | ||||
.Fa name1 | .Fa name1 | ||||
is absolute or includes a ".." component that escapes the starting directory. | is absolute or includes a ".." component that escapes | ||||
the directory hierarchy specified by | |||||
.Fa fd , | |||||
and the process is in capability mode. | |||||
.It Bq Er ENOTCAPABLE | |||||
The | |||||
.Dv AT_BENEATH | .Dv AT_BENEATH | ||||
flag was specified. | flag was provided to | ||||
.Fa linkat | |||||
and the absolute path | |||||
.Fa name1 | |||||
does not have its tail fully contained under the topping directory, | |||||
or the relative path | |||||
.Fa name1 | |||||
escapes it. | |||||
.El | .El | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr chflags 2 , | .Xr chflags 2 , | ||||
.Xr readlink 2 , | .Xr readlink 2 , | ||||
.Xr symlink 2 , | .Xr symlink 2 , | ||||
.Xr unlink 2 | .Xr unlink 2 | ||||
.Sh STANDARDS | .Sh STANDARDS | ||||
The | The | ||||
Show All 21 Lines |