[PATCH] libc: add fallocate() and fallocate64()

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Mon Sep 8 22:17:10 UTC 2014


On Sun, Sep 07, 2014 at 03:33:46PM -0400, basile at opensource.dyc.edu wrote:
> From: "Anthony G. Basile" <blueness at gentoo.org>
> 
> We add the Linux-specific function fallocate() which allows the user to
> directly manipulate allocate space for a file.  fallocate() can operate
> in different modes, but the default mode is equivalent to posix_fallocate()
> which is specified in POSIX.1.
> 
> Recent releases of e2fsprogs 1.42.11 and above expect fallocate64() to be
> available.

Looks good. A few remarks:

$ egrep "(ADVANCED_R|LINUX_SPEC|LFS)" .config
UCLIBC_HAS_LFS=y
UCLIBC_LINUX_SPECIFIC=y
UCLIBC_HAS_ADVANCED_REALTIME=y

libc/sysdeps/linux/common/fallocate.c:17:22: warning: no previous prototype for '_fallocate' [-Wmissing-prototypes]
 int attribute_hidden _fallocate(int fd, int mode, __off_t offset, __off_t len)
----------------------^
libc/sysdeps/linux/common/fallocate64.c:22:22: warning: no previous prototype for '_fallocate64' [-Wmissing-prototypes]
 int attribute_hidden _fallocate64(int fd, int mode, __off64_t offset, __off64_t len)
----------------------^

   text    data     bss     dec     hex filename
     86       0       0      86      56 posix_fallocate.os
    102       0       0     102      66 posix_fallocate64.os
    142       0       0     142      8e fallocate.os
    143       0       0     143      8f fallocate64.os

Attached incremental patch:

   text    data     bss     dec     hex filename
     86       0       0      86      56 posix_fallocate.os
    102       0       0     102      66 posix_fallocate64.os
    117       0       0     117      75 fallocate.os
    118       0       0     118      76 fallocate64.os

We should drop the libc_hidden_proto(fallocate{,64}) since we do not have
internal users (and iff we gain some they should use __libc_fallocate{,64})
though.
I did not test 32bit vs 64bit targets nor all combos of the egrep above.

Care to test and send an updated patch, please?

TIA,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fwd-fallocate-1.patch
Type: text/x-diff
Size: 7911 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20140909/24720b9f/attachment.bin>


More information about the uClibc mailing list