1SYMLINKAT(2) Linux Programmer's Manual SYMLINKAT(2)
2
3
4
6 symlinkat - create a symbolic link relative to a directory file
7 descriptor
8
10 #define _ATFILE_SOURCE
11 #include <stdio.h>
12
13 int symlinkat(const char *oldpath, int newdirfd, const char *newpath);
14
16 The symlinkat() system call operates in exactly the same way as sym‐
17 link(2), except for the differences described in this manual page.
18
19 If the pathname given in newpath is relative, then it is interpreted
20 relative to the directory referred to by the file descriptor newdirfd
21 (rather than relative to the current working directory of the calling
22 process, as is done by symlink(2) for a relative pathname).
23
24 If newpath is relative and newdirfd is the special value AT_FDCWD, then
25 newpath is interpreted relative to the current working directory of the
26 calling process (like symlink(2)).
27
28 If newpath is absolute, then newdirfd is ignored.
29
31 On success, symlinkat() returns 0. On error, -1 is returned and errno
32 is set to indicate the error.
33
35 The same errors that occur for symlink(2) can also occur for sym‐
36 linkat(). The following additional errors can occur for symlinkat():
37
38 EBADF newdirfd is not a valid file descriptor.
39
40 ENOTDIR
41 newpath is relative and newdirfd is a file descriptor referring
42 to a file other than a directory.
43
45 See openat(2) for an explanation of the need for symlinkat().
46
48 This system call is non-standard but is proposed for inclusion in a
49 future revision of POSIX.1.
50
52 symlinkat() was added to Linux in kernel 2.6.16.
53
55 openat(2), path_resolution(2), symlink(2)
56
57
58
59Linux 2.6.16 2006-04-10 SYMLINKAT(2)