I just tried to read files from the filesystem using direct i/o to avoid the operating systems caching effects. The manpage of open lists the flag O_DIRECT for this. Although I included fcntl.h, my compiler complained that it couldn’t find O_DIRECT:
contrib/myfile.c:44: error: ‘O_DIRECT’ undeclared (first use in this function)
The solution was easy: You just have to
before including fnctl.h. This is actually mentioned in the manpage, but only in a footnote that is easy to overlook.