os/ossrv/genericopenlibs/openenvcore/include/dirent.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/dirent.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,120 @@
     1.4 +/*-
     1.5 + * Copyright (c) 1989, 1993
     1.6 + *	The Regents of the University of California.  All rights reserved.
     1.7 + *
     1.8 + * Redistribution and use in source and binary forms, with or without
     1.9 + * modification, are permitted provided that the following conditions
    1.10 + * are met:
    1.11 + * 1. Redistributions of source code must retain the above copyright
    1.12 + *    notice, this list of conditions and the following disclaimer.
    1.13 + * 2. Redistributions in binary form must reproduce the above copyright
    1.14 + *    notice, this list of conditions and the following disclaimer in the
    1.15 + *    documentation and/or other materials provided with the distribution.
    1.16 + * 4. Neither the name of the University nor the names of its contributors
    1.17 + *    may be used to endorse or promote products derived from this software
    1.18 + *    without specific prior written permission.
    1.19 + *
    1.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    1.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.23 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    1.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.30 + * SUCH DAMAGE.
    1.31 + *
    1.32 + *	@(#)dirent.h	8.2 (Berkeley) 7/28/94
    1.33 + * $FreeBSD: src/include/dirent.h,v 1.14 2003/12/07 21:10:06 marcel Exp $
    1.34 + */
    1.35 +
    1.36 +#ifndef _DIRENT_H_
    1.37 +#define _DIRENT_H_
    1.38 +
    1.39 +/*
    1.40 + * The kernel defines the format of directory entries returned by
    1.41 + * the getdirentries(2) system call.
    1.42 + */
    1.43 +#include <sys/cdefs.h>
    1.44 +#include <sys/dirent.h>
    1.45 +
    1.46 +#if __BSD_VISIBLE || __XSI_VISIBLE
    1.47 +/*
    1.48 + * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer
    1.49 + * to the specification.
    1.50 + */
    1.51 +#define	d_ino		d_fileno	/* backward and XSI compatibility */
    1.52 +#endif
    1.53 +
    1.54 +#if __BSD_VISIBLE
    1.55 +
    1.56 +#include <sys/_null.h>
    1.57 +
    1.58 +/* definitions for library routines operating on directories. */
    1.59 +#define	DIRBLKSIZ	1024
    1.60 +
    1.61 +struct _telldir;		/* see telldir.h */
    1.62 +
    1.63 +/* structure describing an open directory. */
    1.64 +typedef struct _dirdesc {
    1.65 +	int	dd_fd;		/* file descriptor associated with directory */
    1.66 +	long	dd_loc;		/* offset in current buffer */
    1.67 +	long	dd_size;	/* amount of data returned by getdirentries */
    1.68 +	char	*dd_buf;	/* data buffer */
    1.69 +	int	dd_len;		/* size of data buffer */
    1.70 +	long	dd_seek;	/* magic cookie returned by getdirentries */
    1.71 +	long	dd_rewind;	/* magic cookie for rewinding */
    1.72 +	int	dd_flags;	/* flags for readdir */
    1.73 +	void	*dd_lock;	/* hack to avoid including <pthread.h> */
    1.74 +	struct _telldir *dd_td;	/* telldir position recording */
    1.75 +} DIR;
    1.76 +
    1.77 +#define	dirfd(dirp)	((dirp)->dd_fd)
    1.78 +
    1.79 +/* flags for opendir2 */
    1.80 +#define DTF_HIDEW	0x0001	/* hide whiteout entries */
    1.81 +#define DTF_NODUP	0x0002	/* don't return duplicate names */
    1.82 +#define DTF_REWIND	0x0004	/* rewind after reading union stack */
    1.83 +#define __DTF_READALL	0x0008	/* everything has been read */
    1.84 +
    1.85 +#else /* !__BSD_VISIBLE */
    1.86 +
    1.87 +typedef	void *	DIR;
    1.88 +
    1.89 +#endif /* __BSD_VISIBLE */
    1.90 +
    1.91 +#ifndef _KERNEL
    1.92 +
    1.93 +__BEGIN_DECLS
    1.94 +#if __BSD_VISIBLE
    1.95 +IMPORT_C int	 alphasort(const void *, const void *);
    1.96 +/* #define getdirentries _getdirentries */
    1.97 +IMPORT_C int	 getdirentries(int, char *, int, long *);
    1.98 +#endif
    1.99 +IMPORT_C DIR	*opendir(const char *);
   1.100 +IMPORT_C struct dirent *
   1.101 +	 readdir(DIR *);
   1.102 +IMPORT_C void	 rewinddir(DIR *);
   1.103 +IMPORT_C int	 alphasort(const void *, const void *);
   1.104 +IMPORT_C int	 scandir(const char *, struct dirent ***,
   1.105 +	    int (*)(struct dirent *), int (*)(const void *, const void *));
   1.106 +
   1.107 +#if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS)
   1.108 +#define readdir64	readdir
   1.109 +#define alphasort64	alphasort
   1.110 +#define scandir64	scandir
   1.111 +#endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */
   1.112 +
   1.113 +
   1.114 +#if __XSI_VISIBLE
   1.115 +IMPORT_C void	 seekdir(DIR *, long);
   1.116 +IMPORT_C long	 telldir(DIR *);
   1.117 +#endif
   1.118 +IMPORT_C int	 closedir(DIR *);
   1.119 +__END_DECLS
   1.120 +
   1.121 +#endif /* !_KERNEL */
   1.122 +
   1.123 +#endif /* !_DIRENT_H_ */