tst-posix_fallocate test failure
Renaud Marquet
rmarquet@gmail.com
Tue Nov 25 22:24:00 GMT 2008
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.
More information about the Libc-help
mailing list