diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/statfsbuf.h | 49 | ||||
-rw-r--r-- | sysdeps/mach/hurd/fstatfs.c | 38 | ||||
-rw-r--r-- | sysdeps/mach/hurd/statfs.c | 42 | ||||
-rw-r--r-- | sysdeps/stub/fstatfs.c | 34 | ||||
-rw-r--r-- | sysdeps/stub/statfs.c | 34 | ||||
-rw-r--r-- | sysdeps/unix/syscalls.list | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/statfsbuf.h | 1 |
7 files changed, 200 insertions, 0 deletions
diff --git a/sysdeps/generic/statfsbuf.h b/sysdeps/generic/statfsbuf.h new file mode 100644 index 0000000000..e5c2dd7f77 --- /dev/null +++ b/sysdeps/generic/statfsbuf.h @@ -0,0 +1,49 @@ +/* Definition of `struct statfs', information about a filesystem. +Copyright (C) 1996 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 +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _STATFSBUF_H + +#define _STATFSBUF_H 1 + +#include <gnu/types.h> + +/* GNU Hurd NOTE: The size of this structure (16 ints) is known in + <hurd/hurd_types.defs>, since it is used in the `file_statfs' RPC. MiG + does not cope at all well with the passed C structure not being of the + expected size. There are some filler words at the end to allow for + future expansion. To increase the size of the structure used in the RPC + and retain binary compatibility, we would need to assign a new message + number. */ + +struct statfs + { + unsigned int f_type; + unsigned int f_bsize; + unsigned int f_blocks; + unsigned int f_bfree; + unsigned int f_bavail; + unsigned int f_files; + unsigned int f_ffree; + __fsid_t f_fsid; + unsigned int f_namelen; + unsigned int f_spare[6]; + }; + + +#endif /* statfsbuf.h */ diff --git a/sysdeps/mach/hurd/fstatfs.c b/sysdeps/mach/hurd/fstatfs.c new file mode 100644 index 0000000000..80bcdcd905 --- /dev/null +++ b/sysdeps/mach/hurd/fstatfs.c @@ -0,0 +1,38 @@ +/* fstatfs -- Return information about the filesystem on which FD resides. +Copyright (C) 1996 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 +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <hurd.h> +#include <hurd/fd.h> +#include <sys/statfs.h> +#include <stddef.h> + +/* Return information about the filesystem on which FD resides. */ +int +__fstatfs (int fd, struct statfs *buf) +{ + error_t err; + + if (err = HURD_DPORT_USE (fd, __file_statfs (port, buf))) + return __hurd_dfail (fd, err); + + return 0; +} + +weak_alias (__fstatfs, fstatfs) + diff --git a/sysdeps/mach/hurd/statfs.c b/sysdeps/mach/hurd/statfs.c new file mode 100644 index 0000000000..9400531a5c --- /dev/null +++ b/sysdeps/mach/hurd/statfs.c @@ -0,0 +1,42 @@ +/* statfs -- Return information about the filesystem on which FILE resides. +Copyright (C) 1996 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 +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <hurd.h> +#include <sys/statfs.h> +#include <stddef.h> + +/* Return information about the filesystem on which FILE resides. */ +int +__statfs (const char *file, struct statfs *buf) +{ + error_t err; + file_t port; + + port = __file_name_lookup (file, 0, 0); + if (port == MACH_PORT_NULL) + return -1; + err = __file_statfs (port, buf); + __mach_port_deallocate (__mach_task_self (), port); + if (err) + return __hurd_fail (err); + return 0; +} + +weak_alias (__statfs, statfs) + diff --git a/sysdeps/stub/fstatfs.c b/sysdeps/stub/fstatfs.c new file mode 100644 index 0000000000..5ef5ccd1b9 --- /dev/null +++ b/sysdeps/stub/fstatfs.c @@ -0,0 +1,34 @@ +/* fstatfs -- Return information about the filesystem on which FD resides. +Copyright (C) 1996 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 +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <errno.h> +#include <sys/statfs.h> +#include <stddef.h> + +/* Return information about the filesystem on which FD resides. */ +int +__fstatfs (int fd, struct statfs *buf) +{ + errno = ENOSYS; + return -1; +} +stub_warning (statfs) + +weak_alias (__fstatfs, fstatfs) + diff --git a/sysdeps/stub/statfs.c b/sysdeps/stub/statfs.c new file mode 100644 index 0000000000..1aa2feeae6 --- /dev/null +++ b/sysdeps/stub/statfs.c @@ -0,0 +1,34 @@ +/* statfs -- Return information about the filesystem on which FILE resides. +Copyright (C) 1996 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 +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <errno.h> +#include <sys/statfs.h> +#include <stddef.h> + +/* Return information about the filesystem on which FILE resides. */ +int +__statfs (const char *file, struct statfs *buf) +{ + errno = ENOSYS; + return -1; +} +stub_warning (statfs) + +weak_alias (__statfs, statfs) + diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list index 4e596bf01b..19c11f4d9d 100644 --- a/sysdeps/unix/syscalls.list +++ b/sysdeps/unix/syscalls.list @@ -54,6 +54,8 @@ sync - sync 0 sync sys_fstat fxstat fstat 2 __syscall_fstat sys_mknod xmknod mknod 3 __syscall_mknod sys_stat xstat stat 2 __syscall_stat +statfs - statfs 2 __statfs statfs +fstatfs - fstatfs 2 __fstatfs fstatfs umask - umask 1 __umask umask uname - uname 1 uname unlink - unlink 1 __unlink unlink diff --git a/sysdeps/unix/sysv/linux/statfsbuf.h b/sysdeps/unix/sysv/linux/statfsbuf.h new file mode 100644 index 0000000000..08a10cb495 --- /dev/null +++ b/sysdeps/unix/sysv/linux/statfsbuf.h @@ -0,0 +1 @@ +#include <asm/statfs.h> |