svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
realpath(3c)
realpath(3C) Standard C Library Functions realpath(3C)
NAME
realpath, frealpath, canonicalize_file_name - resolve pathname
SYNOPSIS
#include <stdlib.h>
char *realpath(const char *restrict file_name,
char *restrict resolved_name);
#include <unistd.h>
char *frealpath(int file_descriptor, char *restrict resolved_name,
size_t size);
#include <stdlib.h>
char *canonicalize_file_name (const char *path);
DESCRIPTION
The realpath() function derives, from the pathname pointed to by
file_name, an absolute pathname that resolves to the same directory en‐
try, whose resolution does not involve ".", "..", or symbolic links. If
resolved_name is not null, the generated pathname is stored as a null-
terminated string, up to a maximum of {PATH_MAX} (defined in lim‐
its.h(3HEAD)) bytes in the buffer pointed to by resolved_name. If re‐
solved_name is null, the generated pathname is stored as a null-termi‐
nated string in a buffer that is allocated as if malloc(3C) were
called.
The frealpath() function derives, from the file_descriptor, an absolute
pathname that resolves to the same file whose resolution does not in‐
volve ".", "..", or symbolic links. If resolved_name is not null, the
generated pathname is stored as a null-terminated string, up to a maxi‐
mum of size bytes in the buffer pointed to by resolved_name. If re‐
solved_name is null, the generated pathname is stored as a null-termi‐
nated string in a buffer that is allocated as if malloc() were called.
In that case, the size argument is the upper limit to the returned
pathname where the special value 0 indicates that no limit is re‐
quested. If a file has multiple links, the name of an arbitrary link
will be returned.
The call canonicalize_file_name(path) is equivalent to the call real‐
path(path, NULL).
RETURN VALUES
On successful completion, these functions return a pointer to the re‐
solved name. Otherwise, these functions return a null pointer and set
errno to indicate the error, and the contents of the buffer pointed to
by resolved_name are left in an indeterminate state.
If the resolved_name argument is a null pointer, the pointer returned
by realpath() and frealpath() can be passed to free(). The pointer re‐
turned by canonicalize_file_name() can always be passed to free().
ERRORS
The realpath() function will fail if:
EACCES Search permission was denied for a component of the
path prefix of file_name.
EINVAL The file_name argument is a null pointer.
EIO An error occurred while reading from the file system.
ELOOP Too many symbolic links were encountered in resolving
file_name.
ELOOP A loop exists in symbolic links encountered during res‐
olution of the file_name argument.
ENAMETOOLONG The file_name argument is longer than {PATH_MAX} or a
pathname component is longer than {NAME_MAX}.
ENOENT A component of file_name does not name an existing file
or file_name points to an empty string.
ENOTDIR A component of the path prefix is not a directory.
The frealpath() function will fail if:
EBADF The file_descriptor is not a valid descriptor.
ENOENT The file_descriptor points to a file without a name in the
file system, or the file name could not be resolved.
The realpath() and frealpath() functions may fail if:
ENOMEM Insufficient storage space is available.
The realpath() function may fail if:
EACCES The file_name argument does not begin with a slash (/)
and none of the symbolic links (if any) processed dur‐
ing pathname resolution of file_name had contents that
began with a slash (/), and either search permission
was denied for the current directory or read or search
permission was denied for a directory above the current
directory in the file hierarchy.
ENAMETOOLONG Pathname resolution of a symbolic link produced an in‐
termediate result whose length exceeds {PATH_MAX}.
USAGE
The realpath() function operates on null-terminated strings.
Execute permission is required for all the directories in the given and
the resolved path.
If a buffer is provided for resolved_name it must be at least
{PATH_MAX} bytes.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe _ Stan‐
dardSee below.
The realpath() function is specified in the POSIX.1-2001 through 2008,
SUS through SUSv4, and XPG4v2 through XPG7 standards. See standards(7)
for details.
The frealpath() and canonicalize_file_name() functions are not speci‐
fied by current standards.
SEE ALSO
getcwd(3C), malloc(3C), sysconf(3C), limits.h(3HEAD), attributes(7),
standards(7)
HISTORY
The frealpath() function was added to Solaris in the Oracle Solaris
11.1.0 release.
The canonicalize_file_name() function was added to Solaris in the Ora‐
cle Solaris 11.0.0 release.
The realpath() function has been included in all Sun and Oracle re‐
leases of Solaris. Support for passing a NULL pointer for the re‐
solved_name parameter to have the result be newly allocated was added
to Solaris in the Oracle Solaris 11.0.0 release. On Solaris releases
prior to 11.0.0, a NULL pointer will cause the function to fail and set
errno to EINVAL.
Oracle Solaris 11.4 27 Aug 2025 realpath(3C)