1realpath(3C)             Standard C Library Functions             realpath(3C)
2
3
4

NAME

6       realpath - resolve pathname
7

SYNOPSIS

9       #include <stdlib.h>
10
11       char *realpath(const char *restrict file_name,
12            char *restrict resolved_name);
13
14

DESCRIPTION

16       The  realpath()  function  derives,  from  the  pathname  pointed to by
17       file_name, an absolute pathname that names the same file, whose resolu‐
18       tion does not involve ".", "..", or symbolic links. The generated path‐
19       name is stored  as  a  null-terminated  string,  up  to  a  maximum  of
20       {PATH_MAX} bytes (defined in limits.h(3HEAD)), in the buffer pointed to
21       by resolved_name.
22

RETURN VALUES

24       On successful completion, realpath() returns a pointer to the  resolved
25       name.   Otherwise,  realpath() returns a null pointer and sets errno to
26       indicate the error, and the  contents  of  the  buffer  pointed  to  by
27       resolved_name are left in an indeterminate state.
28

ERRORS

30       The realpath() function will fail if:
31
32       EACCES          Read or search permission was denied for a component of
33                       file_name.
34
35
36       EINVAL          Either the file_name or  resolved_name  argument  is  a
37                       null pointer.
38
39
40       EIO             An error occurred while reading from the file system.
41
42
43       ELOOP           Too  many  symbolic links were encountered in resolving
44                       file_name.
45
46
47       ELOOP           A loop exists in symbolic links encountered during res‐
48                       olution of the file_name argument.
49
50
51       ENAMETOOLONG    The  file_name  argument is longer than {PATH_MAX} or a
52                       pathname component is longer than {NAME_MAX}.
53
54
55       ENOENT          A component of file_name does not name an existing file
56                       or file_name points to an empty string.
57
58
59       ENOTDIR         A component of the path prefix is not a directory.
60
61
62
63       The realpath() function may fail if:
64
65       ENAMETOOLONG    Pathname  resolution  of  a  symbolic  link produced an
66                       intermediate result whose length exceeds {PATH_MAX}.
67
68
69       ENOMEM          Insufficient storage space is available.
70
71

USAGE

73       The realpath() function operates on null-terminated strings.
74
75
76       Execute permission is required for all the directories in the given and
77       the resolved path.
78
79
80       The  realpath()  function might fail to return to the current directory
81       if an error occurs.
82

ATTRIBUTES

84       See attributes(5) for descriptions of the following attributes:
85
86
87
88
89       ┌─────────────────────────────┬─────────────────────────────┐
90       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
91       ├─────────────────────────────┼─────────────────────────────┤
92       │Interface Stability          │Standard                     │
93       ├─────────────────────────────┼─────────────────────────────┤
94       │MT-Level                     │MT-Safe                      │
95       └─────────────────────────────┴─────────────────────────────┘
96

SEE ALSO

98       getcwd(3C), limits.h(3HEAD), sysconf(3C), attributes(5), standards(5)
99
100
101
102SunOS 5.11                        9 Oct 2003                      realpath(3C)
Impressum