µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
dirent.h
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ distribution.
3 * (https://github.com/micro-os-plus)
4 * Copyright (c) 2015-2023 Liviu Ionescu. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software
7 * for any purpose is hereby granted, under the terms of the MIT license.
8 *
9 * If a copy of the license was not distributed with this file, it can
10 * be obtained from https://opensource.org/licenses/mit/.
11 */
12
13#ifndef POSIX_DIRENT_H_
14#define POSIX_DIRENT_H_
15
16// ----------------------------------------------------------------------------
17
18#include <unistd.h>
19
20#if defined(_POSIX_VERSION)
21
22#pragma GCC diagnostic push
23#if defined(__clang__)
24#pragma clang diagnostic ignored "-Wgnu-include-next"
25#endif
26#include_next <dirent.h>
27#pragma GCC diagnostic pop
28
29#else
30
31#include <sys/types.h>
32
33#ifdef __cplusplus
34extern "C"
35{
36#endif
37
38// ----------------------------------------------------------------------------
39
40#if !defined(OS_INTEGER_DIRENT_NAME_MAX)
41#define OS_INTEGER_DIRENT_NAME_MAX (256)
42#endif
43
44 // --------------------------------------------------------------------------
45
46 // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html
47 struct dirent
48 {
49 ino_t d_ino; /* File serial number. */
50 char d_name[OS_INTEGER_DIRENT_NAME_MAX]; /* Filename string of entry. */
51 };
52
53// The content of this structure is not relevant, it is here just to keep
54// POSIX compatibility, in real life the directory class is used
55// and casted to DIR.
56 typedef struct
57 {
58 ;
59 } DIR;
60
61 // --------------------------------------------------------------------------
62
63 DIR*
64 opendir (const char* dirname);
65
66 struct dirent*
67 readdir (DIR* dirp);
68
69#if 0
70 int
71 readdir_r (DIR* dirp, struct dirent* entry, struct dirent** result);
72#endif
73
74 void
75 rewinddir (DIR* dirp);
76
77 int
78 closedir (DIR* dirp);
79
80// ----------------------------------------------------------------------------
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif /* defined(_POSIX_VERSION) */
87
88#endif /* POSIX_DIRENT_H_ */
#define OS_INTEGER_DIRENT_NAME_MAX
Definition dirent.h:41
struct dirent * readdir(DIR *dirp)
int closedir(DIR *dirp)
void rewinddir(DIR *dirp)
DIR * opendir(const char *dirname)
int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
Definition dirent.h:57
char d_name[(256)]
Definition dirent.h:50
ino_t d_ino
Definition dirent.h:49