Skip to contentSkip to conversation

fallocate.2: mention <linux/falloc.h> for flag definitions

PATCH In review Eric Gouriou 3 participants 3 messages Jun 8, 2011 – Sep 29, 2011 2 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fallocate.2: mention <linux/falloc.h> for flag definitions

Document that <linux/falloc.h> is needed to have the definition of FALLOC_FL_* flags.
---
Notes:
1) <linux/falloc.h> also defines fallocate(), so one does not have to include <fcntl.h> or define _GNU_SOURCE when <linux/falloc.h> is used. However it is true that including <fcntl.h> defines fallocate() if and only if _GNU_SOURCE is defined.

Please let me know if this kind of minutiae deserves to be noted in the page. If so, please direct me to other pages I could use as guides on how to convey such subtleties.

2) Currently only FALLOC_FL_KEEP_SIZE is defined. In progress patches may add FALLOC_FL_PUNCH_HOLE when they land.

---
 man2/fallocate.2 |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
man2/fallocate.2 +1 -0
index 42eefbd..963c39f 100644
@@ -9,6 +9,7 @@ fallocate \- manipulate file space
 .nf
 .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */"
 .B #include <fcntl.h>
+.BR "#include <linux/falloc.h>" "       /* For FALLOC_FL_* definitions */"
 
 .BI "int fallocate(int " fd ", int " mode ", off_t " offset \
 ", off_t " len ");
Signature · 6 lines
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to a message not in the archive

Hello Eric,

I am not sure of the right answer to your initial question. Ulrich Drepper should be able to tell us.

Quoted 2 lines · Eric Gouriou

Document that <linux/falloc.h> is needed to have the definition of FALLOC_FL_* flags.

I was about to apply this patch, and then I realized that the problem may be really lie outside the man page.

Ulrich, the glibc headers declare Linux's fallocate() syscall is _GNU_SOURCE is defined, but not the associated FALLOC_FL_PUNCH_HOLE and FALLOC_FL_KEEP_SIZE constants. Probably this needs to be fixed. Is this a glibc lack or is it that the constants are not exported from kernel headers in the way that glibc needs?

Quoted 6 lines

---
Notes:
1) <linux/falloc.h> also defines fallocate(), so one does not have to include <fcntl.h> or define _GNU_SOURCE when <linux/falloc.h> is used. However it is true that including <fcntl.h> defines fallocate() if and only if _GNU_SOURCE is defined.

Yes, but probably don't need to document this. See my question to Ulrich above.

Quoted 6 lines

Please let me know if this kind of minutiae deserves to be noted in the page. If so, please direct me to other pages I could use as guides on how to convey such subtleties.

2) Currently only FALLOC_FL_KEEP_SIZE is defined. In progress patches may add FALLOC_FL_PUNCH_HOLE when they land.

See the other mail that I just CCed you.

Cheers,

Michael

Quoted 20 lines

---
 man2/fallocate.2 |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
man2/fallocate.2 +0 -0
index 42eefbd..963c39f 100644
@@ -9,6 +9,7 @@ fallocate \- manipulate file space

 .nf
 .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */" .B #include <fcntl.h>
+.BR "#include <linux/falloc.h>" "       /* For FALLOC_FL_* definitions */"

 .BI "int fallocate(int " fd ", int " mode ", off_t " offset \
 ", off_t " len ");
--
1.7.3.1

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to a message not in the archive
Quoted 5 lines · Michael Kerrisk

Ulrich, the glibc headers declare Linux's fallocate() syscall is _GNU_SOURCE is defined, but not the associated FALLOC_FL_PUNCH_HOLE and FALLOC_FL_KEEP_SIZE constants. Probably this needs to be fixed. Is this a glibc lack or is it that the constants are not exported from kernel headers in the way that glibc needs?

The kernel people made it clear that they don't care about correct namespaces in headers. This makes it pretty much impossible to use most kernel headers. I'd love to avoid mirroring headers but this isn't possible without the appropriate #ifdefs in the kernel headers.

I probably will define those constants in fcntl.h.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html