[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] NBD with uClibc 0.9.33.2 - compile problem



On Sun, Feb 03, 2013 at 04:17:50PM +0100, VAGO Tibor wrote:
> Hi,
> 
> I tried to compile nbd 3.2 on my NAS, an ARMv5T based system. I install 
> gentoo-uclibc on it and when I try to compile nbd it cannot find 
> fallocate() function:
> 
> ------------------------------------------------------------------------
> armv5tel-softfloat-linux-uclibceabi-gcc -std=gnu99 -w -Os -march=armv5te 
> -fomit-frame-pointer -pipe -I/usr/include/glib-2.0 
> -I/usr/lib/glib-2.0/include   -w -Os -march=armv5te -fomit-frame-pointer 
> -pipe  -Wl,-O1 -Wl,--as-needed -o nbd-server nbd_server-nbd-server.o 
> -lglib-2.0 -lintl
> nbd_server-nbd-server.o: In function `exptrim':
> nbd-server.c:(.text+0x2274): undefined reference to `fallocate'
> collect2: ld returned 1 exit status
> ------------------------------------------------------------------------
> 
> In configure I can't see any check for fallocate() availability. It just 
> found fcntl.h and it assumes there is fallocate() function?
> 
> In uClibc there is posix_fallocate() and there is no fallocate().
> I don't know what are the differences between posix_fallocate() and 
> fallocate() but if it is equivalent may I use it?
> 
> Regards,
> Tibor

FALLOCATE(2)               Linux Programmer's Manual              FALLOCATE(2)

NAME
       fallocate - manipulate file space

SYNOPSIS
       #define _GNU_SOURCE             /* See feature_test_macros(7) */
       #include <fcntl.h>

       int fallocate(int fd, int mode, off_t offset, off_t len);

DESCRIPTION
       This  is  a nonportable, Linux-specific system call.  For the portable,
       POSIX.1-specified method of ensuring that  space  is  allocated  for  a
       file, see posix_fallocate().



POSIX_FALLOCATE(3)         Linux Programmer's Manual        POSIX_FALLOCATE(3)

NAME
       posix_fallocate - allocate file space

SYNOPSIS
       #include <fcntl.h>

       int posix_fallocate(int fd, off_t offset, off_t len);

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       posix_fallocate():
           _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L


The fallocate() call has an additional mode argument. That might or might not
be relevant. You have to check how it is used. But it should be easy enough
to change the source to use posix_fallocate().

MfG
	Goswin



Reply to: