Date: Wed, 16 Aug 2006 07:49:25 +0200 From: Tobias Roth <roth@iam.unibe.ch> To: Eric Anderson <anderson@centtech.com> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: struct dirent question Message-ID: <20060816054925.GA11651@droopy.unibe.ch> In-Reply-To: <44E29055.3080205@centtech.com> References: <44E29055.3080205@centtech.com>
index | next in thread | previous in thread | raw e-mail
On Tue, Aug 15, 2006 at 10:26:13PM -0500, Eric Anderson wrote:
> Does the ifdef in the struct dirent (pasted in below) make any sense?
> Seems like regardless of whether the __BSD_VISIBLE is defined or not,
> the d_name length will always be 255 + 1.
>
> Eric
>
>
> struct dirent {
> __uint32_t d_fileno; /* file number of entry */
> __uint16_t d_reclen; /* length of this record */
> __uint8_t d_type; /* file type, see below */
> __uint8_t d_namlen; /* length of string in d_name */
> #if __BSD_VISIBLE
> #define MAXNAMLEN 255
> char d_name[MAXNAMLEN + 1]; /* name must be no longer than
> this */
> #else
> char d_name[255 + 1]; /* name must be no longer than
> this */
> #endif
> };
The difference is whether MAXNAMLEN is defined or not, the value of d_name
is irrelevant. How far not defining MAXNAMLEN (in the case __BSD_VISIBLE=
false) makes sense, I cannot tell.
cheers, t.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060816054925.GA11651>
