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