This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: tst-posix_fallocate test failure
- From: Renaud Marquet <rmarquet at gmail dot com>
- To: Carlos O'Donell <carlos at systemhalted dot org>
- Cc: libc-help at sourceware dot org
- Date: Tue, 25 Nov 2008 23:23:40 +0100
- Subject: Re: tst-posix_fallocate test failure
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=qT9iF5xYOsYfe1y3DpLTIycEVKS4B6yFvXKryFUiVgs=; b=hFT3bAy2y7nNZ7de9tISaUWZ+Yd+kX93CuggNVIYd31xHAfyXwblb0vl5uzrlPBtY/ pDhrpH9956tdOXBo4RCvCcbJIYtFSw+zZcwuG3GRBa9RW+N6Qop4oQQek8nqWrc3CJkG Ppqm5OnQ5uP4AaO2cTdalcDlU+t3ygI1PtfMY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=dvZtwFHZqEOkxdv4R7eGs9rJqv+hhoc5w4/1m/Wycv26DGMyNaXUx1A2RO1BL1z1DB 46kXjtSH0vkj8Vt/reDYXz/pnnjdvSJbmmJtJgjhrwO+nMjCvD/W8BRkH2HHZG6V3p/Z voqQK1fn+1Hnj4M7jDRofeaZrn/A6xysx8fV8=
- References: <1227553256.7239.10.camel@antec> <119aab440811250610x36da147ch39d74b760ba6e69@mail.gmail.com>
As suggested I did a little step into the failing test. But I cannot
figure out what's happening. I hope you'll get a clearer idea of the
problem with this. Here's a dump of the gdb session :
(gdb) break do_test
Breakpoint 1 at 0x10000758
(gdb) run
Starting program: /tmp/fstat/test
Breakpoint 1, do_test () at test.c:25
25 if (posix_fallocate (fd, 50, 1024) != 0)
(gdb) break posix_fallocate
Breakpoint 2 at 0x4000014342c:
file ../sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c, line 38.
(gdb) cont
Continuing.
Breakpoint 2, posix_fallocate (fd=4, offset=50, len=1024)
at ../sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c:38
38 if (__builtin_expect (__have_fallocate >= 0, 1))
(gdb) s
35 {
(gdb)
38 if (__builtin_expect (__have_fallocate >= 0, 1))
(gdb)
42 int res = INTERNAL_SYSCALL (fallocate, err, 4, fd, 0, offset,
len);
(gdb)
44 if (! INTERNAL_SYSCALL_ERROR_P (res, err))
(gdb)
42 int res = INTERNAL_SYSCALL (fallocate, err, 4, fd, 0, offset,
len);
(gdb)
44 if (! INTERNAL_SYSCALL_ERROR_P (res, err))
(gdb)
58 }
(gdb)
do_test () at test.c:31
31 if (fstat64 (fd, &st) != 0)
(gdb) cont
Continuing.
st.st_size : 0
file size changed in second posix_fallocate
Program exited with code 01.
(gdb)
I don't understand why the code in lines 42 and 44 seems to be executed
twice (as I'm not familiar with gdb I don't know if it's related to gdb
or could be the source of the problem). I took a look at
INTERNAL_SYSCALL macro definition, it's mainly assembler code (in
sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h)
excerpt of sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c :
32 /* Reserve storage for the data of the file associated with FD. */
33 int
34 posix_fallocate (int fd, __off_t offset, __off_t len)
35 {
36 #ifdef __NR_fallocate
37 # ifndef __ASSUME_FALLOCATE
38 if (__builtin_expect (__have_fallocate >= 0, 1))
39 # endif
40 {
41 INTERNAL_SYSCALL_DECL (err);
42 int res = INTERNAL_SYSCALL (fallocate, err, 4, fd, 0, offset,
len);
43
44 if (! INTERNAL_SYSCALL_ERROR_P (res, err))
45 return 0;
46
47 # ifndef __ASSUME_FALLOCATE
48 if (__builtin_expect (INTERNAL_SYSCALL_ERRNO (res, err) ==
ENOSYS, 0))
49 __have_fallocate = -1;
50 else
51 # endif
52 if (INTERNAL_SYSCALL_ERRNO (res, err) != EOPNOTSUPP)
53 return INTERNAL_SYSCALL_ERRNO (res, err);
54 }
55 #endif
56
57 return internal_fallocate (fd, offset, len);
58 }
Cheers,
Renaud
Le mardi 25 novembre 2008 Ã 09:10 -0500, Carlos O'Donell a Ãcrit :
> On Mon, Nov 24, 2008 at 2:00 PM, Renaud Marquet <rmarquet@gmail.com> wrote:
> > I'm compiling glibc (2.8-20080929) for playstation3 (PowerPC 64bits).
> > Building was ok but when I ran the test suite, there was only one
> > failure, concerning posix_fallocate :
> >
> > "file size after first posix_fallocate call is 0, expected 1280"
> >
> > It seems the function does nothing at all although do not send any error
> > code. I checked fstat64 function work correctly on another file, so the
> > problem comes from posix_fallocate.
>
> This is very little information. Have you tried to debug the test?
>
> Cheers,
> Carlos.