bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

struct dirent d_type element


From: Ray Simard
Subject: struct dirent d_type element
Date: Sun, 23 May 2004 20:24:31 -0700
User-agent: Mozilla Thunderbird 0.5+ (X11/20040212)

Hello!

I hope this can be helpful.

A while ago, after various system upgrades, gtags began creating empty
databases. There were no error indications, just - well, nothing.

I traced the problem down to the getdirs function in file.c, the part
compiled if HAVE_DP_D_TYPE is defined. For some bizarre reason, every
file it found seemed to have a type 0 (unknown). It looked like a system
problem. (I have my system details below, although, as I'll mention
next, I consider that moot now.)

I was about to start digging into this when I checked the readdir(3)
man page. There I found information that suggests that POSIX only
recognizes the d_name element officially, and seems to want to
discourage using any other field. Here's the text:

"According to POSIX, the dirent structure contains a field char d_name[]
of unspecified size, with at most NAME_MAX characters
preceding  the  terminating  null  character.  Use of other fields will
harm the portability of your programs.  POSIX 1003.1-2001 also
documents the field ino_t d_ino as an XSI extension."

When I saw that I decided that it would be best to dispense with using
d_type altogether. Fortunately, the lstat option is easily chosen to
replace it; so I edited acinclude.m4 to remove the check for a d_type
field in the declaration of struct dirent. gtags then came to life just
fine!

Best regards,

Ray Simard
address@hidden

PS: My system:

SuSE 9.0
Athlon kernel, 2.4.21-202-Athlon
glib 1.2.10-488
glibc 2.3.2-92

global version 4.6





reply via email to

[Prev in Thread] Current Thread [Next in Thread]