2008-07-09 15:16:00 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2002-2008, Haiku Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2004-09-15 03:08:21 +04:00
|
|
|
#ifndef _DIRENT_H
|
|
|
|
#define _DIRENT_H
|
|
|
|
|
2002-07-11 18:59:59 +04:00
|
|
|
|
2002-08-20 15:10:51 +04:00
|
|
|
#include <sys/types.h>
|
2002-08-03 06:03:27 +04:00
|
|
|
|
2002-07-11 18:59:59 +04:00
|
|
|
|
|
|
|
typedef struct dirent {
|
2002-11-29 05:49:58 +03:00
|
|
|
dev_t d_dev; /* device */
|
|
|
|
dev_t d_pdev; /* parent device (only for queries) */
|
|
|
|
ino_t d_ino; /* inode number */
|
|
|
|
ino_t d_pino; /* parent inode (only for queries) */
|
|
|
|
unsigned short d_reclen; /* length of this record, not the name */
|
|
|
|
char d_name[1]; /* name of the entry (null byte terminated) */
|
2002-07-11 18:59:59 +04:00
|
|
|
} dirent_t;
|
|
|
|
|
2008-07-09 15:16:00 +04:00
|
|
|
typedef struct __DIR DIR;
|
2002-07-11 18:59:59 +04:00
|
|
|
|
|
|
|
#ifndef MAXNAMLEN
|
|
|
|
# ifdef NAME_MAX
|
|
|
|
# define MAXNAMLEN NAME_MAX
|
|
|
|
# else
|
|
|
|
# define MAXNAMLEN 256
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2002-10-26 17:07:30 +04:00
|
|
|
#ifdef __cplusplus
|
2002-07-11 18:59:59 +04:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2004-09-15 03:08:21 +04:00
|
|
|
DIR *opendir(const char *dirname);
|
|
|
|
struct dirent *readdir(DIR *dir);
|
|
|
|
int readdir_r(DIR *dir, struct dirent *entry, struct dirent **_result);
|
|
|
|
int closedir(DIR *dir);
|
|
|
|
void rewinddir(DIR *dir);
|
2005-11-04 19:13:13 +03:00
|
|
|
void seekdir(DIR *dir, long int loc);
|
|
|
|
long int telldir(DIR *);
|
2002-07-11 18:59:59 +04:00
|
|
|
|
2008-07-17 05:01:52 +04:00
|
|
|
/* Non-POSIX extension to get the FD out of the private DIR */
|
2008-07-17 05:22:13 +04:00
|
|
|
int dirfd(const DIR *dir);
|
2008-07-17 05:01:52 +04:00
|
|
|
|
2002-10-26 17:07:30 +04:00
|
|
|
#ifdef __cplusplus
|
2002-07-11 18:59:59 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-09-15 03:08:21 +04:00
|
|
|
#endif /* _DIRENT_H */
|