Commit | Line | Data |
---|---|---|
931b8415 | 1 | .\" Copyright (c) 1983, 1991 The Regents of the University of California. |
88b3ccf2 | 2 | .\" All rights reserved. |
69e3a22f | 3 | .\" |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
88b3ccf2 | 5 | .\" |
931b8415 | 6 | .\" @(#)readlink.2 6.8 (Berkeley) %G% |
69e3a22f | 7 | .\" |
931b8415 CL |
8 | .Dd |
9 | .Dt READLINK 2 | |
10 | .Os BSD 4.2 | |
11 | .Sh NAME | |
12 | .Nm readlink | |
13 | .Nd read value of a symbolic link | |
14 | .Sh SYNOPSIS | |
15 | .Fd #include <unistd.h> | |
16 | .Ft int | |
17 | .Fn readlink "const char *path" "char *buf" "int bufsiz" | |
18 | .Sh DESCRIPTION | |
19 | .Fn Readlink | |
69e3a22f | 20 | places the contents of the symbolic link |
931b8415 | 21 | .Fa path |
69e3a22f | 22 | in the buffer |
931b8415 | 23 | .Fa buf , |
69e3a22f | 24 | which has size |
931b8415 CL |
25 | .Fa bufsiz . |
26 | .Nm Readlink | |
27 | does not append a | |
28 | .Dv NUL | |
29 | character to | |
30 | .Fa buf . | |
31 | .Sh RETURN VALUES | |
69e3a22f | 32 | The call returns the count of characters placed in the buffer |
931b8415 CL |
33 | if it succeeds, or a -1 if an error occurs, placing the error |
34 | code in the global variable | |
35 | .Va errno . | |
36 | .Sh ERRORS | |
37 | .Fn Readlink | |
e0220bda | 38 | will fail if: |
931b8415 CL |
39 | .Bl -tag -width ENAMETOOLONG |
40 | .It Bq Er ENOTDIR | |
69e3a22f | 41 | A component of the path prefix is not a directory. |
931b8415 | 42 | .It Bq Er EINVAL |
b5984ffe | 43 | The pathname contains a character with the high-order bit set. |
931b8415 | 44 | .It Bq Er ENAMETOOLONG |
b5984ffe KM |
45 | A component of a pathname exceeded 255 characters, |
46 | or an entire path name exceeded 1023 characters. | |
931b8415 | 47 | .It Bq Er ENOENT |
69e3a22f | 48 | The named file does not exist. |
931b8415 | 49 | .It Bq Er EACCES |
b5984ffe | 50 | Search permission is denied for a component of the path prefix. |
931b8415 | 51 | .It Bq Er ELOOP |
b5984ffe | 52 | Too many symbolic links were encountered in translating the pathname. |
931b8415 | 53 | .It Bq Er EINVAL |
69e3a22f | 54 | The named file is not a symbolic link. |
931b8415 | 55 | .It Bq Er EIO |
fd690c8b | 56 | An I/O error occurred while reading from the file system. |
931b8415 CL |
57 | .It Bq Er EFAULT |
58 | .Fa Buf | |
69e3a22f | 59 | extends outside the process's allocated address space. |
931b8415 CL |
60 | .El |
61 | .Sh SEE ALSO | |
62 | .Xr stat 2 , | |
63 | .Xr lstat 2 , | |
64 | .Xr symlink 2 | |
65 | .Sh HISTORY | |
66 | The | |
67 | .Nm | |
68 | function call appeared in | |
69 | .Bx 4.2 . |