Skip to content

Commit

Permalink
Fix building on x86 with older kernel headers.
Browse files Browse the repository at this point in the history
Fix building on x86 when older linux headers lack __NR_fallocate define.
  • Loading branch information
Mike Frsyinger authored and Ulrich Drepper committed Nov 15, 2009
1 parent 5ec794b commit f9a7bd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sysdeps/unix/sysv/linux/i386/fallocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <errno.h>
#include <fcntl.h>
#include <sysdep.h>

Expand All @@ -28,5 +29,10 @@ extern int __call_fallocate (int fd, int mode, __off64_t offset, __off64_t len)
int
fallocate (int fd, int mode, __off_t offset, __off_t len)
{
#ifdef __NR_fallocate
return __call_fallocate (fd, mode, offset, len);
#else
__set_errno (ENOSYS);
return -1;
#endif
}
6 changes: 6 additions & 0 deletions sysdeps/unix/sysv/linux/i386/fallocate64.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <errno.h>
#include <fcntl.h>
#include <sysdep.h>

Expand All @@ -28,5 +29,10 @@ extern int __call_fallocate (int fd, int mode, __off64_t offset, __off64_t len)
int
fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
{
#ifdef __NR_fallocate
return __call_fallocate (fd, mode, offset, len);
#else
__set_errno (ENOSYS);
return -1;
#endif
}

0 comments on commit f9a7bd5

Please sign in to comment.