#include <sys/dir.h>
sys/dir.h
macroDIRSIZ
The DIRSIZ macro gives the minimum record length which will hold
the directory entry. This requires the amount of space in struct direct
without the d_name field, plus enough space for the name with a terminating
null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
#define DIRSIZ(dp) (((unsigned long)&((struct direct *)0)->d_name + (dp)->d_namlen+1 + 3) & ~3)