Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getdirentries(2) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                         getdirentries(2)



        _________________________________________________________________
        getdirentries                                         System Call
        Get directory entries in a file system-independent format.
        _________________________________________________________________


        SYNTAX

        #include <sys/dir.h>

        int  getdirentries (fildes, buffer, count, basep)
        int             fildes;
        char           *buffer;
        unsigned        count;
        long           *basep;


        PARAMETERS

        fildes         File descriptor of the directory to list.


        buffer         Buffer to hold the directory entries.


        count          Size of the buffer in bytes.


        basep          Pointer to the location containing the current
                       file position.


        DESCRIPTION

        Getdirentries attempts to put directory entries from the
        directory referenced by <fildes> into the buffer pointed to by
        <buffer>, in a file system-independent format.  Up to <count>
        bytes of data are transferred from the directory, beginning at
        the current file offset.  For some file systems, <count> must be
        greater than the block size associated with the file.  Sizes less
        than this may cause errors on certain NFS filesystems.

        The data in the buffer is a series of "direct" structures.  The
        "direct" structure is defined as




              struct direct {
                      unsigned long   d_fileno;
                      unsigned short  d_reclen;



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                         getdirentries(2)



                      unsigned short  d_namelen;
                      char            d_name[MAXNAMELEN+1];
              };



        The "d_fileno" entry is a number that is unique for each distinct
        file in the file system.  Files that are linked by hard links
        have the same "d_fileno".  The "d_reclen" entry is the length, in
        bytes, of the directory record.  The "d_name" and "d_namelen"
        entries specify the actual filename and its length.

        Upon return, the actual number of bytes transferred is returned,
        and <basep> is set to the position pointer of the returned
        directory entries. The current position pointer associated with
        <fildes> is set to point to the next block of entries.  The
        pointer is not necessarily incremented by the number of bytes
        returned by "getdirentries".  If the value returned is zero, the
        end of the directory has been reached.  The current position
        pointer may be set and retrieved by "lseek".  It is not safe to
        set the current position pointer to any value other than a value
        previously returned by "lseek" or a value previously returned in
        <basep> or zero.


        ACCESS CONTROL

        None.


        RETURN VALUE

        >0             The number of bytes actually transferred.


        0              The end of the directory has been reached.


        -1             An error occurred.  Errno is set to indicate the
                       error.


        EXCEPTIONS

        Errno may be set to one of the following error codes:


        EBADF          Fildes is not a valid file descriptor for reading.


        EINTR          Normal termination. A signal interrupted the pause



        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                         getdirentries(2)



                       operation.


        ENOTDIR        Fildes is not a directory.


        SEE ALSO

        The related manual sections:  getdents(2), lseek(2), open(2),
        dir(4).












































        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026