Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getdirentries.(2) — A/UX 0.7

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

open(2)

lseek(2)



     getdirentries(2)                                 getdirentries(2)



     NAME
          getdirentries - gets directory entries in a filesystem
          independent format

     SYNOPSIS
          #include <sys/types.h>
          #include <sys/dir.h>

          cc = getdirentries(d, buf, nbytes, basep)
          int cc, d;
          char *buf;
          int nbytes;
          long *basep


     DESCRIPTION
          getdirentries attempts to put directory entries from the
          directory referenced by the descriptor d into the buffer
          pointed to by buf, in a filesystem independent format.  Up
          to nbytes of data will be transferred.  nbytes must be
          greater than the block size associated with the file, see
          stat(2).  Sizes less than this may cause errors on certain
          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;
                      unsigned short    d_namlen;
                      char              d_name[MAXNAMELEN + 1];
               };


          The dfileno entry is a number which is unique for each
          distinct file in the filesystem.  Files that are linked by
          hard links (see link(2)) have the same dfileno.  The
          dreclen entry is the length, in bytes, of the directory
          record.  The dname and dnamelen entries specify the actual
          file name and its length.

          Upon return, the actual number of bytes transferred is
          returned.  The current position pointer associated with d 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(2).  The basep
          entry is a pointer to a location into which the current
          position of the buffer just transferred is placed.  It is
          not safe to set the current position pointer to any value



     Page 1                                        (last mod. 1/14/87)





     getdirentries(2)                                 getdirentries(2)



          other than a value previously returned by lseek(2) or a
          value previously returned in basep or zero.

     RETURN VALUE
          If successful, the number of bytes actually transferred is
          returned.  Otherwise, a -1 is returned and the global
          variable errno is set to indicate the error.

     SEE ALSO
          open(2), lseek(2).













































     Page 2                                        (last mod. 1/14/87)



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