1READLINK(2) System Calls Manual READLINK(2)
2
3
4
6 readlink - read value of a symbolic link
7
9 cc = readlink(path, buf, bufsiz)
10 int cc;
11 char *path, *buf;
12 int bufsiz;
13
15 Readlink places the contents of the symbolic link name in the buffer
16 buf, which has size bufsiz. The contents of the link are not null ter‐
17 minated when returned.
18
20 The call returns the count of characters placed in the buffer if it
21 succeeds, or a -1 if an error occurs, placing the error code in the
22 global variable errno.
23
25 Readlink will fail and the file mode will be unchanged if:
26
27 [ENOTDIR] A component of the path prefix is not a directory.
28
29 [EINVAL] The pathname contains a character with the high-order
30 bit set.
31
32 [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an
33 entire path name exceeded 1023 characters.
34
35 [ENOENT] The named file does not exist.
36
37 [EACCES] Search permission is denied for a component of the path
38 prefix.
39
40 [ELOOP] Too many symbolic links were encountered in translating
41 the pathname.
42
43 [EINVAL] The named file is not a symbolic link.
44
45 [EIO] An I/O error occurred while reading from the file sys‐
46 tem.
47
48 [EFAULT] Buf extends outside the process's allocated address
49 space.
50
52 stat(2), lstat(2), symlink(2)
53
54
55
564.2 Berkeley Distribution August 26, 1985 READLINK(2)