There's a comment here that talks about the padding, but it would be
clearer to show it.
I was recreating this struct recently, and following the man page
didn't work. The text sounds like d_name itself is padded.
Index: dir.5
===================================================================
RCS file: /cvs/src/share/man/man5/dir.5,v
retrieving revision 1.18
diff -u -p -r1.18 dir.5
--- dir.5 21 Jan 2014 03:15:46 -0000 1.18
+++ dir.5 25 Dec 2014 22:58:31 -0000
@@ -85,6 +85,7 @@ struct dirent {
u_int16_t d_reclen; /* length of this record */
u_int8_t d_type; /* file type, see below */
u_int8_t d_namlen; /* length of string in d_name */
+ u_int_8_t d_pad[4]; /* no padding after d_name */
#define MAXNAMLEN 255
char d_name[MAXNAMLEN + 1]; /* maximum name length */
};