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