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 <fcntl.h> /* Definition of AT_* constants */
12 #include <stdio.h>
13
14 int symlinkat(const char *oldpath, int newdirfd, const char *newpath);
15
17 The symlinkat() system call operates in exactly the same way as sym‐
18 link(2), except for the differences described in this manual page.
19
20 If the pathname given in newpath is relative, then it is interpreted
21 relative to the directory referred to by the file descriptor newdirfd
22 (rather than relative to the current working directory of the calling
23 process, as is done by symlink(2) for a relative pathname).
24
25 If newpath is relative and newdirfd is the special value AT_FDCWD, then
26 newpath is interpreted relative to the current working directory of the
27 calling process (like symlink(2)).
28
29 If newpath is absolute, then newdirfd is ignored.
30
32 On success, symlinkat() returns 0. On error, -1 is returned and errno
33 is set to indicate the error.
34
36 The same errors that occur for symlink(2) can also occur for sym‐
37 linkat(). The following additional errors can occur for symlinkat():
38
39 EBADF newdirfd is not a valid file descriptor.
40
41 ENOTDIR
42 newpath is relative and newdirfd is a file descriptor referring
43 to a file other than a directory.
44
46 symlinkat() was added to Linux in kernel 2.6.16.
47
49 POSIX.1-2008.
50
52 See openat(2) for an explanation of the need for symlinkat().
53
55 openat(2), symlink(2), path_resolution(7), symlink(7)
56
58 This page is part of release 3.22 of the Linux man-pages project. A
59 description of the project, and information about reporting bugs, can
60 be found at http://www.kernel.org/doc/man-pages/.
61
62
63
64Linux 2008-08-21 SYMLINKAT(2)