#include <sys/dirent.h>

sys/dirent.h

13 macros · 1 struct

structdirent

size 1048, align 8
__uint64_td_inofile number of entry
__uint64_td_seekoffseek offset (optional, used by servers)
__uint16_td_reclenlength of this record
__uint16_td_namlenlength of string in d_name
__uint8_td_typefile type, see below
char[1024]d_nameentry name (up to MAXPATHLEN bytes)

macrod_fileno

#define d_fileno d_ino
backward compatibility

macroMAXNAMLEN

#define MAXNAMLEN __DARWIN_MAXNAMLEN

macroDT_UNKNOWN

File types
#define DT_UNKNOWN 0

macroDT_FIFO

#define DT_FIFO 1

macroDT_CHR

#define DT_CHR 2

macroDT_DIR

#define DT_DIR 4

macroDT_BLK

#define DT_BLK 6

macroDT_REG

#define DT_REG 8

macroDT_LNK

#define DT_LNK 10

macroDT_SOCK

#define DT_SOCK 12

macroDT_WHT

#define DT_WHT 14

macroIFTODT

Convert between stat structure types and directory types.
#define IFTODT(mode) (((mode) & 0170000) >> 12)

macroDTTOIF

#define DTTOIF(dirtype) ((dirtype) << 12)