2016-01-04 17:05:18 +01:00
|
|
|
/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
|
1998-03-20 17:35:19 +01:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 06:58:11 +02:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1998-03-20 17:35:19 +01:00
|
|
|
|
|
|
|
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
|
2001-07-06 06:58:11 +02:00
|
|
|
Lesser General Public License for more details.
|
1998-03-20 17:35:19 +01:00
|
|
|
|
2001-07-06 06:58:11 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-10 00:18:22 +01:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1998-03-20 17:35:19 +01:00
|
|
|
|
2003-09-17 02:49:19 +02:00
|
|
|
#include <stddef.h>
|
2000-01-18 11:53:15 +01:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/statfs.h>
|
1998-03-20 17:35:19 +01:00
|
|
|
#include <sys/statvfs.h>
|
|
|
|
|
2003-09-17 02:49:19 +02:00
|
|
|
extern void __internal_statvfs (const char *name, struct statvfs *buf,
|
2014-05-29 06:11:29 +02:00
|
|
|
struct statfs *fsbuf, int fd);
|
2003-09-17 02:49:19 +02:00
|
|
|
|
1998-03-20 17:35:19 +01:00
|
|
|
|
|
|
|
int
|
2015-06-09 21:52:01 +02:00
|
|
|
__statvfs (const char *file, struct statvfs *buf)
|
1998-03-20 17:35:19 +01:00
|
|
|
{
|
2000-01-18 11:17:32 +01:00
|
|
|
struct statfs fsbuf;
|
1998-03-20 17:35:19 +01:00
|
|
|
|
2000-01-18 11:17:32 +01:00
|
|
|
/* Get as much information as possible from the system. */
|
2000-01-18 11:53:15 +01:00
|
|
|
if (__statfs (file, &fsbuf) < 0)
|
1998-03-20 17:35:19 +01:00
|
|
|
return -1;
|
|
|
|
|
2003-09-17 02:49:19 +02:00
|
|
|
/* Convert the result. */
|
2014-05-29 06:11:29 +02:00
|
|
|
__internal_statvfs (file, buf, &fsbuf, -1);
|
2000-01-18 11:53:15 +01:00
|
|
|
|
2000-01-18 11:17:32 +01:00
|
|
|
/* We signal success if the statfs call succeeded. */
|
|
|
|
return 0;
|
1998-03-20 17:35:19 +01:00
|
|
|
}
|
2015-06-09 21:52:01 +02:00
|
|
|
weak_alias (__statvfs, statvfs)
|
|
|
|
libc_hidden_weak (statvfs)
|