os/ossrv/genericopenlibs/openenvcore/include/dirent.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*-
sl@0
     2
 * Copyright (c) 1989, 1993
sl@0
     3
 *	The Regents of the University of California.  All rights reserved.
sl@0
     4
 *
sl@0
     5
 * Redistribution and use in source and binary forms, with or without
sl@0
     6
 * modification, are permitted provided that the following conditions
sl@0
     7
 * are met:
sl@0
     8
 * 1. Redistributions of source code must retain the above copyright
sl@0
     9
 *    notice, this list of conditions and the following disclaimer.
sl@0
    10
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    11
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    12
 *    documentation and/or other materials provided with the distribution.
sl@0
    13
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    14
 *    may be used to endorse or promote products derived from this software
sl@0
    15
 *    without specific prior written permission.
sl@0
    16
 *
sl@0
    17
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    27
 * SUCH DAMAGE.
sl@0
    28
 *
sl@0
    29
 *	@(#)dirent.h	8.2 (Berkeley) 7/28/94
sl@0
    30
 * $FreeBSD: src/include/dirent.h,v 1.14 2003/12/07 21:10:06 marcel Exp $
sl@0
    31
 */
sl@0
    32
sl@0
    33
#ifndef _DIRENT_H_
sl@0
    34
#define _DIRENT_H_
sl@0
    35
sl@0
    36
/*
sl@0
    37
 * The kernel defines the format of directory entries returned by
sl@0
    38
 * the getdirentries(2) system call.
sl@0
    39
 */
sl@0
    40
#include <sys/cdefs.h>
sl@0
    41
#include <sys/dirent.h>
sl@0
    42
sl@0
    43
#if __BSD_VISIBLE || __XSI_VISIBLE
sl@0
    44
/*
sl@0
    45
 * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer
sl@0
    46
 * to the specification.
sl@0
    47
 */
sl@0
    48
#define	d_ino		d_fileno	/* backward and XSI compatibility */
sl@0
    49
#endif
sl@0
    50
sl@0
    51
#if __BSD_VISIBLE
sl@0
    52
sl@0
    53
#include <sys/_null.h>
sl@0
    54
sl@0
    55
/* definitions for library routines operating on directories. */
sl@0
    56
#define	DIRBLKSIZ	1024
sl@0
    57
sl@0
    58
struct _telldir;		/* see telldir.h */
sl@0
    59
sl@0
    60
/* structure describing an open directory. */
sl@0
    61
typedef struct _dirdesc {
sl@0
    62
	int	dd_fd;		/* file descriptor associated with directory */
sl@0
    63
	long	dd_loc;		/* offset in current buffer */
sl@0
    64
	long	dd_size;	/* amount of data returned by getdirentries */
sl@0
    65
	char	*dd_buf;	/* data buffer */
sl@0
    66
	int	dd_len;		/* size of data buffer */
sl@0
    67
	long	dd_seek;	/* magic cookie returned by getdirentries */
sl@0
    68
	long	dd_rewind;	/* magic cookie for rewinding */
sl@0
    69
	int	dd_flags;	/* flags for readdir */
sl@0
    70
	void	*dd_lock;	/* hack to avoid including <pthread.h> */
sl@0
    71
	struct _telldir *dd_td;	/* telldir position recording */
sl@0
    72
} DIR;
sl@0
    73
sl@0
    74
#define	dirfd(dirp)	((dirp)->dd_fd)
sl@0
    75
sl@0
    76
/* flags for opendir2 */
sl@0
    77
#define DTF_HIDEW	0x0001	/* hide whiteout entries */
sl@0
    78
#define DTF_NODUP	0x0002	/* don't return duplicate names */
sl@0
    79
#define DTF_REWIND	0x0004	/* rewind after reading union stack */
sl@0
    80
#define __DTF_READALL	0x0008	/* everything has been read */
sl@0
    81
sl@0
    82
#else /* !__BSD_VISIBLE */
sl@0
    83
sl@0
    84
typedef	void *	DIR;
sl@0
    85
sl@0
    86
#endif /* __BSD_VISIBLE */
sl@0
    87
sl@0
    88
#ifndef _KERNEL
sl@0
    89
sl@0
    90
__BEGIN_DECLS
sl@0
    91
#if __BSD_VISIBLE
sl@0
    92
IMPORT_C int	 alphasort(const void *, const void *);
sl@0
    93
/* #define getdirentries _getdirentries */
sl@0
    94
IMPORT_C int	 getdirentries(int, char *, int, long *);
sl@0
    95
#endif
sl@0
    96
IMPORT_C DIR	*opendir(const char *);
sl@0
    97
IMPORT_C struct dirent *
sl@0
    98
	 readdir(DIR *);
sl@0
    99
IMPORT_C void	 rewinddir(DIR *);
sl@0
   100
IMPORT_C int	 alphasort(const void *, const void *);
sl@0
   101
IMPORT_C int	 scandir(const char *, struct dirent ***,
sl@0
   102
	    int (*)(struct dirent *), int (*)(const void *, const void *));
sl@0
   103
sl@0
   104
#if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS)
sl@0
   105
#define readdir64	readdir
sl@0
   106
#define alphasort64	alphasort
sl@0
   107
#define scandir64	scandir
sl@0
   108
#endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */
sl@0
   109
sl@0
   110
sl@0
   111
#if __XSI_VISIBLE
sl@0
   112
IMPORT_C void	 seekdir(DIR *, long);
sl@0
   113
IMPORT_C long	 telldir(DIR *);
sl@0
   114
#endif
sl@0
   115
IMPORT_C int	 closedir(DIR *);
sl@0
   116
__END_DECLS
sl@0
   117
sl@0
   118
#endif /* !_KERNEL */
sl@0
   119
sl@0
   120
#endif /* !_DIRENT_H_ */