realpath(3c) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

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);


       char *frealpath(int file_descriptor, char *restrict resolved_name,
            size_t size);


       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
       entry,  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
       resolved_name  is null, the generated pathname is stored as a null-ter‐
       minated 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
       involve ".", "..", 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
       resolved_name is null, the generated pathname is stored as a  null-ter‐
       minated  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 requested. If a file has multiple links, an arbitrary name  will  be
       returned.


       The  call  canonicalize_file_name(path) is equivalent to the call real‐
       path(path, NULL).

RETURN VALUES
       On successful completion, realpath() and frealpath() return  a  pointer
       to  the  resolved  name. Otherwise, realpath() and frealpath() 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.

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
                       intermediate 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.

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 standards(7).


SEE ALSO
       getcwd(3C), malloc(3C),  sysconf(3C),  limits.h(3HEAD),  attributes(7),
       standards(7)



Oracle Solaris 11.4               21 May 2012                     realpath(3C)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3