Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
Data Structures | Macros | Typedefs | Functions
dirent.h File Reference
#include <stdint.h>
#include <sys/limits.h>
#include <sys/stat.h>
#include "kconfig.h"
Include dependency graph for dirent.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dirent
 
struct  dirstream
 

Macros

#define DT_UNKNOWN   0
 
#define DT_FIFO   1
 
#define DT_CHR   2
 
#define DT_DIR   4
 
#define DT_BLK   6
 
#define DT_REG   8
 
#define DT_LNK   10
 
#define DT_SOCK   12
 
#define IFTODT(mode)   (((mode) &S_IFMT) >> 12)
 
#define DTTOIF(dirtype)   ((dirtype) << 12)
 

Typedefs

typedef struct dirstream DIR
 

Functions

DIRopendir (const char *name)
 Open a directory stream corresponding to the directory name, and return a pointer to the directory stream. More...
 
struct direntreaddir (DIR *dirp)
 Return the next entry of the directory stream. The entry belongs to the stream and is overwritten by the next call on it. More...
 
int closedir (DIR *dirp)
 Close a directory stream and release what it holds. More...
 

Function Documentation

◆ closedir()

int closedir ( DIR dirp)

Close a directory stream and release what it holds.

Parameters
dirpThe directory stream to close.
Return values
int0 on success and -1 on error, with the reason left in errno.

◆ opendir()

DIR* opendir ( const char *  name)

Open a directory stream corresponding to the directory name, and return a pointer to the directory stream.

Parameters
nameThe file path to the directory.
Return values
DIR*: The directory stream on success and a null pointer on error, with the reason left in errno.

◆ readdir()

struct dirent* readdir ( DIR dirp)

Return the next entry of the directory stream. The entry belongs to the stream and is overwritten by the next call on it.

Parameters
dirpThe directory stream to read.
Return values
structdirent *: The entry on success, and a null pointer at the end of the directory or on error, which are told apart by errno.