O_DIRECT is missing from correct location in headers

Bug #84640 reported by Shaya Potter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
Invalid
Medium
Matthias Klose

Bug Description

this could possibly be a bug in the man page, but my guess it's in the dev package

man page for open syscall says to include

       #include <sys/types.h>
       #include <sys/stat.h>
       #include <fcntl.h>

simple test program

----
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main()
{
        int fd;

        fd = open("/tmp/123", O_RDWR | O_DIRECT);
}
----

attempt to compile

spotter@dent:/tmp$ gcc test.c
test.c: In function ‘main’:
test.c:9: error: ‘O_DIRECT’ undeclared (first use in this function)
test.c:9: error: (Each undeclared identifier is reported only once
test.c:9: error: for each function it appears in.)

its in asm-generic/fcntl.h which is for some reason not being pulled in, I doubt one is meant to #include <asm/fcntl.h> just to get this defined (especially as it will conflict with <fcntl.h>

Revision history for this message
Matthias Klose (doko) wrote :

rejecting, see open(2):

       The O_DIRECT flag was introduced in SGI IRIX, where it has alignment restrictions sim‐
       ilar to those of Linux 2.4. IRIX has also a fcntl(2) call to query appropriate align‐
       ments, and sizes. FreeBSD 4.x introduced a flag of same name, but without alignment
       restrictions. Support was added under Linux in kernel version 2.4.10. Older Linux
       kernels simply ignore this flag. One may have to define the _GNU_SOURCE macro to get
       its definition.

Changed in glibc:
importance: Undecided → Medium
status: Unconfirmed → Confirmed
assignee: nobody → doko
status: Confirmed → Rejected
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.