Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
`fallocate()` flags again available as per documentation
Previously, the `fcntl.h` header file from the _glibc_ package did not include flags for the `fallocate()` function. As a consequence, programs using `fallocate()` according to the man page did not compile. The missing flags have been added by indirect inclusion of the `<linux/falloc.h>` file and compilation of such programs is again possible.
Description of problem:
RHEL7's kernel supports the fallocate() call and its various flags, such as FALLOC_FL_PUNCH_HOLE. Likewise the man page for fallocate(2) lists this option and says <fcntl.h> should give you the necessary definitions.
However, while FALLOC_FL_PUNCH_HOLE (and other fallocate() flags) is included in /usr/include/linux/falloc.h (supplied by the kernel), that file is not included, directly or indirectly by /usr/include/fcntl.h
Version-Release number of selected component (if applicable):
glibc-2.17-196.el7.ppc64le
kernel-3.10.0-693.el7.ppc64le
How reproducible:
100%
Steps to Reproduce:
1. Create fallocate.c:
#define _GNU_SOURCE
#include <fcntl.h>
int test(int fd)
{
return fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
0, 1024 * 1024);
}
2. Compile source file above with:
$ gcc -Wall -c fallocate.c
Actual results:
$ gcc -c fallocate.c
fallocate.c: In function ‘test’:
fallocate.c:7:23: error: ‘FALLOC_FL_PUNCH_HOLE’ undeclared (first use in this function)
return fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
^
fallocate.c:7:23: note: each undeclared identifier is reported only once for each function it appears in
fallocate.c:7:46: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared (first use in this function)
return fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
^
Expected results:
File compiles successfully.
Additional info:
This works correctly in Fedora 26 (and therefore, presumably, in upstream glibc). In Fedora, fcntl.h indirectly includes linux/falloc.h via bits/fcntl-linux.h.
Relevant upstream commit:
commit 257dabc059447934a90be6fce4b5d2a5f4b63dfd
Author: Joseph Myers <joseph>
Date: Wed Dec 14 18:23:15 2016 +0000
Include <linux/falloc.h> in bits/fcntl-linux.h.
This patch makes bits/fcntl-linux.h include <linux/falloc.h> to define
the FALLOC_* flags under __USE_GNU (linux/falloc.h defines only those
bits, nothing else).
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2018:3092
Description of problem: RHEL7's kernel supports the fallocate() call and its various flags, such as FALLOC_FL_PUNCH_HOLE. Likewise the man page for fallocate(2) lists this option and says <fcntl.h> should give you the necessary definitions. However, while FALLOC_FL_PUNCH_HOLE (and other fallocate() flags) is included in /usr/include/linux/falloc.h (supplied by the kernel), that file is not included, directly or indirectly by /usr/include/fcntl.h Version-Release number of selected component (if applicable): glibc-2.17-196.el7.ppc64le kernel-3.10.0-693.el7.ppc64le How reproducible: 100% Steps to Reproduce: 1. Create fallocate.c: #define _GNU_SOURCE #include <fcntl.h> int test(int fd) { return fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1024 * 1024); } 2. Compile source file above with: $ gcc -Wall -c fallocate.c Actual results: $ gcc -c fallocate.c fallocate.c: In function ‘test’: fallocate.c:7:23: error: ‘FALLOC_FL_PUNCH_HOLE’ undeclared (first use in this function) return fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, ^ fallocate.c:7:23: note: each undeclared identifier is reported only once for each function it appears in fallocate.c:7:46: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared (first use in this function) return fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, ^ Expected results: File compiles successfully. Additional info: This works correctly in Fedora 26 (and therefore, presumably, in upstream glibc). In Fedora, fcntl.h indirectly includes linux/falloc.h via bits/fcntl-linux.h.