]>
Commit | Line | Data |
---|---|---|
db01a903 MK |
1 | .\" Hey Emacs! This file is -*- nroff -*- source. |
2 | .\" | |
3 | .\" This manpage is Copyright (C) 2006, Michael Kerrisk | |
4 | .\" | |
5 | .\" Permission is granted to make and distribute verbatim copies of this | |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
8 | .\" | |
9 | .\" Permission is granted to copy and distribute modified versions of this | |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
c13182ef | 13 | .\" |
db01a903 MK |
14 | .\" Since the Linux kernel and libraries are constantly changing, this |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
17 | .\" the use of the information contained herein. The author(s) may not | |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
c13182ef | 21 | .\" |
db01a903 MK |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
24 | .\" | |
25 | .\" | |
26 | .TH LINKAT 2 2006-04-10 "Linux 2.6.16" "Linux Programmer's Manual" | |
27 | .SH NAME | |
28 | linkat \- create a file link relative to directory file descriptors | |
29 | .SH SYNOPSIS | |
30 | .nf | |
d44417fb | 31 | .B #define _ATFILE_SOURCE |
db01a903 MK |
32 | .B #include <unistd.h> |
33 | .sp | |
c13182ef | 34 | .BI "int linkat(int " olddirfd ", const char *" oldpath , |
db01a903 MK |
35 | .BI " int " newdirfd ", const char *" newpath ", int " flags ); |
36 | .fi | |
37 | .SH DESCRIPTION | |
38 | The | |
39 | .BR linkat () | |
40 | system call operates in exactly the same way as | |
41 | .BR link (2), | |
42 | except for the differences described in this manual page. | |
43 | ||
c13182ef | 44 | If the pathname given in |
db01a903 MK |
45 | .I oldpath |
46 | is relative, then it is interpreted relative to the directory | |
47 | referred to by the file descriptor | |
c13182ef MK |
48 | .IR olddirfd |
49 | (rather than relative to the current working directory of | |
db01a903 MK |
50 | the calling process, as is done by |
51 | .BR link (2) | |
52 | for a relative pathname). | |
53 | ||
1343b604 | 54 | If |
db01a903 | 55 | .I oldpath |
c13182ef | 56 | is relative and |
db01a903 MK |
57 | .I olddirfd |
58 | is the special value | |
59 | .BR AT_FDCWD , | |
60 | then | |
61 | .I oldpath | |
c13182ef | 62 | is interpreted relative to the current working |
db01a903 MK |
63 | directory of the calling process (like |
64 | .BR link (2)). | |
65 | ||
1343b604 | 66 | If |
db01a903 | 67 | .IR oldpath |
c13182ef MK |
68 | is absolute, then |
69 | .I olddirfd | |
db01a903 MK |
70 | is ignored. |
71 | ||
72 | The interpretation of | |
73 | .I newpath | |
c13182ef MK |
74 | is as for |
75 | .IR oldpath , | |
db01a903 MK |
76 | except that a relative pathname is interpreted relative |
77 | to the directory referred to by the file descriptor | |
78 | .IR newdirfd . | |
79 | ||
ab926035 MK |
80 | By default, |
81 | .BR linkat (2), | |
c13182ef | 82 | does not dereference |
ab926035 | 83 | .I oldpath |
c13182ef | 84 | if it is a symbolic link (like |
ab926035 MK |
85 | .BR link (2)). |
86 | Since Linux 2.6.18, the flag | |
87 | .B AT_SYMLINK_FOLLOW | |
c13182ef | 88 | can be specified |
ab926035 MK |
89 | .I flags |
90 | to cause | |
91 | .I oldpath | |
92 | to be dereferenced if it is a symbolic link. | |
93 | Before kernel 2.6.18, the | |
db01a903 | 94 | .I flags |
ab926035 | 95 | argument was unused, and had to be specified as 0. |
db01a903 MK |
96 | .SH "RETURN VALUE" |
97 | On success, | |
c13182ef MK |
98 | .BR linkat () |
99 | returns 0. | |
db01a903 MK |
100 | On error, \-1 is returned and |
101 | .I errno | |
102 | is set to indicate the error. | |
103 | .SH ERRORS | |
104 | The same errors that occur for | |
105 | .BR link (2) | |
106 | can also occur for | |
107 | .BR linkat (). | |
c13182ef | 108 | The following additional errors can occur for |
db01a903 MK |
109 | .BR linkat (): |
110 | .TP | |
111 | .B EBADF | |
112 | .I olddirfd | |
113 | or | |
114 | .I newdirfd | |
115 | is not a valid file descriptor. | |
116 | .TP | |
117 | .B ENOTDIR | |
118 | .I oldpath | |
b328773d | 119 | is relative and |
db01a903 MK |
120 | .I olddirfd |
121 | is a file descriptor referring to a file other than a directory; | |
122 | or similar for | |
123 | .I newpath | |
124 | and | |
125 | .IR newdirfd | |
126 | .SH NOTES | |
127 | See | |
128 | .BR openat (2) | |
129 | for an explanation of the need for | |
130 | .BR linkat (). | |
131 | .SH "CONFORMING TO" | |
132 | This system call is non-standard but is proposed | |
133 | for inclusion in a future revision of POSIX.1. | |
134 | .SH VERSIONS | |
135 | .BR linkat () | |
136 | was added to Linux in kernel 2.6.16. | |
137 | .SH "SEE ALSO" | |
db01a903 MK |
138 | .BR link (2), |
139 | .BR openat (2), | |
140 | .BR path_resolution (2) |