[BACK]Return to dirent.h CVS log [TXT][DIR] Up to [local] / src / include

Annotation of src/include/dirent.h, Revision 1.8

1.8     ! millert     1: /*     $OpenBSD: dirent.h,v 1.7 2002/02/16 21:27:17 millert Exp $      */
1.1       deraadt     2: /*     $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $   */
                      3:
                      4: /*-
                      5:  * Copyright (c) 1989, 1993
                      6:  *     The Regents of the University of California.  All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *     This product includes software developed by the University of
                     19:  *     California, Berkeley and its contributors.
                     20:  * 4. Neither the name of the University nor the names of its contributors
                     21:  *    may be used to endorse or promote products derived from this software
                     22:  *    without specific prior written permission.
                     23:  *
                     24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     34:  * SUCH DAMAGE.
                     35:  *
                     36:  *     @(#)dirent.h    8.2 (Berkeley) 7/28/94
                     37:  */
                     38:
                     39: #ifndef _DIRENT_H_
                     40: #define _DIRENT_H_
                     41:
                     42: /*
1.2       deraadt    43:  * POSIX doesn't mandate this, but X/Open XPG 4.2 does.
                     44:  */
                     45: #ifndef _POSIX_SOURCE
                     46: #include <sys/types.h>
                     47: #endif
                     48:
                     49: /*
1.1       deraadt    50:  * The kernel defines the format of directory entries returned by
                     51:  * the getdirentries(2) system call.
                     52:  */
                     53: #include <sys/dirent.h>
                     54:
                     55: #ifdef _POSIX_SOURCE
                     56: typedef void * DIR;
                     57: #else
                     58:
                     59: #define        d_ino           d_fileno        /* backward compatibility */
                     60:
                     61: /* definitions for library routines operating on directories. */
                     62: #define        DIRBLKSIZ       1024
                     63:
                     64: /* structure describing an open directory. */
                     65: typedef struct _dirdesc {
                     66:        int     dd_fd;          /* file descriptor associated with directory */
                     67:        long    dd_loc;         /* offset in current buffer */
                     68:        long    dd_size;        /* amount of data returned by getdirentries */
                     69:        char    *dd_buf;        /* data buffer */
                     70:        int     dd_len;         /* size of data buffer */
                     71:        long    dd_seek;        /* magic cookie returned by getdirentries */
                     72:        long    dd_rewind;      /* magic cookie for rewinding */
                     73:        int     dd_flags;       /* flags for readdir */
                     74: } DIR;
                     75:
                     76: #define        dirfd(dirp)     ((dirp)->dd_fd)
                     77:
                     78: /* flags for opendir2 */
                     79: #define DTF_HIDEW      0x0001  /* hide whiteout entries */
                     80: #define DTF_NODUP      0x0002  /* don't return duplicate names */
                     81: #define DTF_REWIND     0x0004  /* rewind after reading union stack */
                     82: #define __DTF_READALL  0x0008  /* everything has been read */
                     83:
                     84: #ifndef NULL
1.5       espie      85: #ifdef         __GNUG__
1.6       espie      86: #define        NULL    __null
1.5       espie      87: #else
1.1       deraadt    88: #define        NULL    0
1.5       espie      89: #endif
1.1       deraadt    90: #endif
                     91:
                     92: #endif /* _POSIX_SOURCE */
                     93:
                     94: #ifndef _KERNEL
                     95:
                     96: #include <sys/cdefs.h>
                     97:
                     98: __BEGIN_DECLS
1.7       millert    99: DIR *opendir(const char *);
                    100: struct dirent *readdir(DIR *);
                    101: void rewinddir(DIR *);
                    102: int closedir(DIR *);
1.1       deraadt   103: #ifndef _POSIX_SOURCE
1.7       millert   104: DIR *__opendir2(const char *, int);
                    105: long telldir(const DIR *);
                    106: void seekdir(DIR *, long);
1.8     ! millert   107: int scandir(const char *, struct dirent ***,
        !           108:     int (*)(struct dirent *), int (*)(const void *, const void *));
1.7       millert   109: int alphasort(const void *, const void *);
                    110: int getdirentries(int, char *, int, long *);
1.1       deraadt   111: #endif /* not POSIX */
1.7       millert   112: int readdir_r(DIR *, struct dirent *, struct dirent **);
1.1       deraadt   113: __END_DECLS
                    114:
                    115: #endif /* !_KERNEL */
                    116:
                    117: #endif /* !_DIRENT_H_ */