The man pages for lseek(2) state one should include <sys/types.h> and <unistd.h>. Doing so does not export SEEK_HOLE and SEEK_DATA. Freshly built from git version 2.17.90, top commit 28831a9a671b109e49d0a4ddce00a08d734bfc97. The following dummy source should build but doesn't: -- #include <sys/types.h> #include <unistd.h> void main(void) { lseek(0, 0, SEEK_DATA); lseek(0, 0, SEEK_HOLE); } -- Errors: /tmp/test.c: In function 'main': /tmp/test.c:7: error: 'SEEK_DATA' undeclared (first use in this function) /tmp/test.c:7: error: (Each undeclared identifier is reported only once /tmp/test.c:7: error: for each function it appears in.) /tmp/test.c:8: error: 'SEEK_HOLE' undeclared (first use in this function) Including <linux/fs.h> is a work-around, but that should really be included internally.
Please report this to the man pages project, I've added the man pages maintainer to this report as well. For details on reporting man-pages bugs: https://www.kernel.org/doc/man-pages/reporting_bugs.html marking as INVALID since it's not a bug in glibc itself but in the man-pages.
So you really want a user space app to include <linux/fs.h> directly!?
No, I want the man pages clear enough that you know to add a define for _GNU_SOURCE. Try the following #define _GNU_SOURCE 1 #include <sys/types.h> #include <unistd.h> void main(void) { lseek(0, 0, SEEK_DATA); lseek(0, 0, SEEK_HOLE); } have a look at /usr/include/unistd.h and read the glibc info pages about feature test macros to learn about _GNU_SOURCE.
Ok, thanks.
(In reply to comment #3) > No, I want the man pages clear enough that you know to add a define for Thanks, Andreas, for adding me. I've added this text to the lseek(2) page: The _GNU_SOURCE feature test macro must be defined in order to obtain the definitions of SEEK_DATA and SEEK_HOLE from <unistd.h>. > have a look at /usr/include/unistd.h and read the glibc info pages about > feature test macros to learn about _GNU_SOURCE. Or, for even more detail: http://man7.org/linux/man-pages/man7/feature_test_macros.7.html