From 51d1ca00fd1ddc2ed77b615b7a23ecdf3e8a55a9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 24 Jun 2003 18:59:03 +0000 Subject: Update. 2003-06-24 Ulrich Drepper * sysdeps/unix/sysv/linux/fstatfs64.c (__fstatfs64): Add support for the fstatfs64 syscall. * sysdeps/unix/sysv/linux/statfs64.c (__statfs64): Add support for the statfs64 syscall. * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_STATFS64 appropriately. * sysdeps/unix/sysv/linux/internal_statvfs.c: Use f_frsize field from statfs structure if it has been filled in. * sysdeps/unix/sysv/linux/bits/statfs.h (struct statfs): Add f_frsize field. (struct statfs64): Likewise. * sysdeps/unix/sysv/linux/alpha/bits/statfs.h: Likewise. * sysdeps/unix/sysv/linux/s390/bits/statfs.h: Likewise. instead of __libc_cleanup_region_*. --- ChangeLog | 21 ++++++++++++++++++++- sysdeps/unix/sysv/linux/fstatfs64.c | 27 ++++++++++++++++++++++++++- sysdeps/unix/sysv/linux/internal_statvfs.c | 7 ++++--- sysdeps/unix/sysv/linux/kernel-features.h | 5 +++++ sysdeps/unix/sysv/linux/statfs64.c | 26 +++++++++++++++++++++++++- 5 files changed, 80 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index a944b356a9..f4f7a86f02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2003-06-24 Ulrich Drepper + + * sysdeps/unix/sysv/linux/fstatfs64.c (__fstatfs64): Add support + for the fstatfs64 syscall. + * sysdeps/unix/sysv/linux/statfs64.c (__statfs64): Add support for + the statfs64 syscall. + + * sysdeps/unix/sysv/linux/kernel-features.h: Define + __ASSUME_STATFS64 appropriately. + + * sysdeps/unix/sysv/linux/internal_statvfs.c: Use f_frsize field + from statfs structure if it has been filled in. + + * sysdeps/unix/sysv/linux/bits/statfs.h (struct statfs): Add f_frsize + field. + (struct statfs64): Likewise. + * sysdeps/unix/sysv/linux/alpha/bits/statfs.h: Likewise. + * sysdeps/unix/sysv/linux/s390/bits/statfs.h: Likewise. + 2003-06-24 Richard Henderson * sysdeps/unix/sysv/linux/alpha/syscalls.list (pread, pwrite): Use @@ -40,7 +59,7 @@ * sysdeps/pthread/aio_suspend.c (aio_suspend): Set errno to the result of pthread_cond_wait if there was an error. Use pthread_cleanup_* - instead of __lbic_cleanup_region_*. + instead of __libc_cleanup_region_*. 2003-06-20 Richard Henderson diff --git a/sysdeps/unix/sysv/linux/fstatfs64.c b/sysdeps/unix/sysv/linux/fstatfs64.c index c1d9454317..48afd1f4d1 100644 --- a/sysdeps/unix/sysv/linux/fstatfs64.c +++ b/sysdeps/unix/sysv/linux/fstatfs64.c @@ -1,5 +1,5 @@ /* Return information about the filesystem on which FD resides. - Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1998,1999,2000,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,11 +21,34 @@ #include #include #include +#include + +/* Defined in statfs64.c. */ +extern int __no_statfs64 attribute_hidden; /* Return information about the filesystem on which FD resides. */ int __fstatfs64 (int fd, struct statfs64 *buf) { +#ifdef __NR_fstatfs64 +# if __ASSUME_STATFS64 == 0 + if (! __no_statfs64) +# endif + { + int result = INLINE_SYSCALL (fstatfs64, 3, fd, sizeof (*buf), buf); + +# if __ASSUME_STATFS64 == 0 + if (result == 0 || errno != ENOSYS) +# endif + return result; + +# if __ASSUME_STATFS64 == 0 + __no_statfs64 = 1; +# endif + } +#endif + +#if __ASSUME_STATFS64 == 0 struct statfs buf32; if (__fstatfs (fd, &buf32) < 0) @@ -40,8 +63,10 @@ __fstatfs64 (int fd, struct statfs64 *buf) buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; buf->f_namelen = buf32.f_namelen; + buf->f_frsize = buf32.f_frsize; memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); return 0; +#endif } weak_alias (__fstatfs64, fstatfs64) diff --git a/sysdeps/unix/sysv/linux/internal_statvfs.c b/sysdeps/unix/sysv/linux/internal_statvfs.c index 744c8d9fd6..9317cef90d 100644 --- a/sysdeps/unix/sysv/linux/internal_statvfs.c +++ b/sysdeps/unix/sysv/linux/internal_statvfs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -19,8 +19,9 @@ /* Now fill in the fields we have information for. */ buf->f_bsize = fsbuf.f_bsize; - /* Linux does not support f_frsize, so set it to the full block size. */ - buf->f_frsize = fsbuf.f_bsize; + /* Linux has the f_frsize size only in later version of the kernel. + If the value is not filled in use f_bsize. */ + buf->f_frsize = fsbuf.f_frsize ?: fsbuf.f_bsize; buf->f_blocks = fsbuf.f_blocks; buf->f_bfree = fsbuf.f_bfree; buf->f_bavail = fsbuf.f_bavail; diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 469f5f48bc..188479dd49 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -308,3 +308,8 @@ #if __LINUX_KERNEL_VERSION >= 132422 # define __ASSUME_FUTEX_REQUEUE 1 #endif + +/* The statfs64 syscalls are available in 2.5.74. */ +#if __LINUX_KERNEL_VERSION >= 132426 +# define __ASSUME_STATFS64 1 +#endif diff --git a/sysdeps/unix/sysv/linux/statfs64.c b/sysdeps/unix/sysv/linux/statfs64.c index 08abab65a2..210e4648bd 100644 --- a/sysdeps/unix/sysv/linux/statfs64.c +++ b/sysdeps/unix/sysv/linux/statfs64.c @@ -1,5 +1,5 @@ /* Return information about the filesystem on which FILE resides. - Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1998,1999,2000,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,11 +21,33 @@ #include #include #include +#include + +int __no_statfs64 attribute_hidden; /* Return information about the filesystem on which FILE resides. */ int __statfs64 (const char *file, struct statfs64 *buf) { +#ifdef __NR_statfs64 +# if __ASSUME_STATFS64 == 0 + if (! __no_statfs64) +# endif + { + int result = INLINE_SYSCALL (statfs64, 3, file, sizeof (*buf), buf); + +# if __ASSUME_STATFS64 == 0 + if (result == 0 || errno != ENOSYS) +# endif + return result; + +# if __ASSUME_STATFS64 == 0 + __no_statfs64 = 1; +# endif + } +#endif + +#if __ASSUME_STATFS64 == 0 struct statfs buf32; if (__statfs (file, &buf32) < 0) @@ -40,8 +62,10 @@ __statfs64 (const char *file, struct statfs64 *buf) buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; buf->f_namelen = buf32.f_namelen; + buf->f_frsize = buf32.f_frsize; memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); return 0; +#endif } weak_alias (__statfs64, statfs64) -- cgit v1.2.3