| 1 | /* Get filesystem statistics (deprecated). Linux version. |
| 2 | Copyright (C) 1997-2020 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. |
| 5 | |
| 6 | The GNU C Library is free software; you can redistribute it and/or |
| 7 | modify it under the terms of the GNU Lesser General Public |
| 8 | License as published by the Free Software Foundation; either |
| 9 | version 2.1 of the License, or (at your option) any later version. |
| 10 | |
| 11 | The GNU C Library is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | Lesser General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU Lesser General Public |
| 17 | License along with the GNU C Library; if not, see |
| 18 | <https://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | #include <shlib-compat.h> |
| 21 | |
| 22 | /* This deprecated syscall is no longer used (replaced with {f}statfs). */ |
| 23 | #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_28) |
| 24 | |
| 25 | # include <sysdep.h> |
| 26 | # include <errno.h> |
| 27 | |
| 28 | # ifndef DEV_TO_KDEV |
| 29 | # define DEV_TO_KDEV(__dev) \ |
| 30 | ({ \ |
| 31 | unsigned long long int k_dev; \ |
| 32 | k_dev = dev & ((1ULL << 32) - 1); \ |
| 33 | if (k_dev != dev) \ |
| 34 | return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); \ |
| 35 | (unsigned int) k_dev; \ |
| 36 | }) |
| 37 | # endif |
| 38 | |
| 39 | struct ustat |
| 40 | { |
| 41 | __daddr_t f_tfree; /* Number of free blocks. */ |
| 42 | __ino_t f_tinode; /* Number of free inodes. */ |
| 43 | char f_fname[6]; |
| 44 | char f_fpack[6]; |
| 45 | }; |
| 46 | |
| 47 | int |
| 48 | __old_ustat (dev_t dev, struct ustat *ubuf) |
| 49 | { |
| 50 | # ifdef __NR_ustat |
| 51 | return INLINE_SYSCALL_CALL (ustat, DEV_TO_KDEV (dev), ubuf); |
| 52 | # else |
| 53 | return INLINE_SYSCALL_ERROR_RETURN_VALUE (ENOSYS); |
| 54 | # endif |
| 55 | } |
| 56 | compat_symbol (libc, __old_ustat, ustat, GLIBC_2_0); |
| 57 | #endif /* SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_28) */ |
| 58 | |