HP 3000 Manuals

pathconf [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation


MPE/iX Developer's Kit Reference Manual Volume I

pathconf 

Gets configuration variable for path name.

Syntax 

     #include <unistd.h>
     long pathconf(char *pathname, int name);

Parameters 

pathname         is the name of the file or directory.

name             is a symbol indicating the variable, the value of which
                 you want to determine, relative to the file or directory
                 specified in pathname.  .

Description 

pathconf() lets you determine the value of a configuration variable
associated with a particular file.  If pathconf() can determine the value
of the requested variable, it returns that value as its result.

The name argument may be any one of a set of symbols defined in
<unistd.h>.  Each symbol stands for a configuration variable.  The
following list shows the possible symbols and the variables that each
symbol stands for:

_PC_LINK_MAX           stands for LINK_MAX defined in <limits.h>--the
                       maximum number of links the file can have.  If
                       pathname is a directory, pathconf() returns the
                       maximum number of links which can be established
                       to the directory itself.

_PC_MAX_CANON          stands for MAX_CANON defined in <limits.h>--the
                       maximum number of bytes in a terminal canonical
                       input line.  pathname must refer to a terminal
                       file.

_PC_MAX_INPUT          stands for MAX_INPUT defined in <limits.h>--the
                       minimum number of bytes for which space is
                       available in a terminal input queue, which means
                       the maximum number of bytes that a portable
                       application may have the user enter before the
                       application actually reads the input.  pathname 
                       must refer to a terminal file.

_PC_NAME_MAX           stands for NAME_MAX defined in <limits.h>--the
                       maximum number of characters in a filename (not
                       including any terminating 0 if the filename is
                       stored as a string).  This only refers to the
                       filename itself, that is, the last component of
                       the file's path name.  pathname must be a
                       directory, and pathconf() returns the maximum
                       length of filenames for files in the directory.

_PC_PATH_MAX           stands for PATH_MAX defined in <limits.h>--the
                       maximum number of characters in a complete path
                       name (not including any terminating \0 if the path
                       name is stored as a string).  pathname must be a
                       directory, and pathconf() returns the maximum
                       length of a relative path name when the specified
                       directory is the working directory.

_PC_PIPE_BUF           stands for PIPE_BUF defined in <limits.h>--the
                       maximum number of bytes that can be written
                       `atomically' to a pipe.  If more than this number
                       of bytes are written to a pipe, the operation may
                       take more than one physical write operation and
                       may require more than one physical read operation
                       to read the data on the other end of the pipe.  If
                       pathname is a FIFO file, pathconf() returns the
                       value for the file itself.  If pathname is a
                       directory, pathconf() returns the value for any
                       FIFOs which exist or can be created under the
                       directory.  If pathname is any other kind of file,
                       the behavior is undefined.

_PC_CHOWN _RESTRICTED  stands for _POSIX_CHOWN_RESTRICTED defined in the
                       <unistd.h>.  This indicates that the use of the
                       chown() function is restricted--see chown() for
                       more details.  If pathname is a directory,
                       pathconf() returns the value for any kind of file
                       under the directory, but not for subdirectories of
                       the directory.

_PC_NO_TRUNC           stands for _POSIX_NO_TRUNC defined in <unistd.h>.
                       This indicates that an error is to be generated if
                       a file name is longer than NAME_MAX. pathname must
                       be a directory, and the value returned by
                       pathconf() applies to all files under that
                       directory.

_PC_VDISABLE           stands for _POSIX_VDISABLE defined in <unistd.h>.
                       This indicates that terminal special characters
                       can be disabled using this character value, if it
                       is defined; see tcsetattr() for details.  pathname 
                       must refer to a terminal file.

For _POSIX_CHOWN_RESTRICTED, _POSIX_NO_TRUNC, and _POSIX_VDISABLE,
pathconf() returns -1 if the option is turned off and another value
otherwise.

If a particular variable has no limit (for example PATH_MAX), pathconf()
returns -1 but does not change errno.

Errors 

If pathconf() cannot determine an appropriate value, it returns -1 and
sets errno to one of the following:

EACCES            CAUSE           The process does not have search permission on some
                                  component of the pathname prefix.
                  ACTION          Ensure that the process has search permissions on all
                                  components of the pathname prefix.

EINVAL            CAUSE           name is not a valid variable code, or the given
                                  variable cannot be associated with the specified
                                  file.
                  ACTION          Ensure that name is a valid variable code.

          Table 4-0.  (cont.) 

ENAMETOOLONG      CAUSE           pathname is longer than PATH_MAX characters, or some
                                  component of pathname is longer than NAME_MAX and
                                  _POSIX_NO_TRUNC is set.
                  ACTION          Unset the configuration variable _POSIX_NO_TRUNC'  to
                                  disable checking the length of pathname or  modify
                                  pathname to ensure that the entire name is  less than
                                  PATH_MAX characters in length and that each component
                                  is less than NAME_MAX characters in length.

ENOENT            CAUSE           There is no filenamed pathname, or the pathname 
                                  argument is an empty string.
                  ACTION          Ensure that you provide a pathname and that pathname 
                                  is a valid file.

ENOTDIR           CAUSE           Some component of the pathname prefix is not a
                                  directory.
                  ACTION          Ensure that all components of pathname are valid
                                  directories.

See Also 

fpathconf()



MPE/iX 5.0 Documentation