Solved Two Versions of Directory Entry Header (dirent.h)

ThothK

Member

Reaction score: 3
Messages: 30

Hello People,

There is a version of the Directory Entry definition file (dirent.h) in /usr/include/ and another version of /usr/include/sys/.
I believe that for FreeBSD programming I should use /usr/include/dirent.h.
Is this correct?
I note that the /usr/include/ version does include the /usr/include/sys/ version.


=thoth=
 

yuripv

Active Member

Reaction score: 71
Messages: 172

You should use the one listed in the man page for the function/definition you need.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,278
Messages: 29,707

Code:
SYNOPSIS
     #include <dirent.h>
Code:
     The directory entry format is defined in the file <sys/dirent.h> (which
     should not be included directly by applications):
From dirent(5).
 
OP
OP
T

ThothK

Member

Reaction score: 3
Messages: 30

Hi SirDice,

Code:
SYNOPSIS
     #include <dirent.h>
Code:
     The directory entry format is defined in the file <sys/dirent.h> (which
     should not be included directly by applications):
From dirent(5).
I happened to see that on the Ubuntu box my elder son is using. After reading this post, I see the warning in the man page on a FreeBSD laptop.
However, I was looking at the source files on one of my FreeBSD laptops.
Code:
Predator: ~: uname -a
FreeBSD Predator 11.2-RELEASE FreeBSD 11.2-RELEASE #0 r335510: Fri Jun 22 04:32:14 UTC 2018     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
Surprisingly, that sentence is not in either file.
I am still getting used to the idea of checking for a man page for an include.


Thank you for answering.


=thoth=
 
Top