2016-01-04 16:05:18 +00:00
|
|
|
/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
|
1998-03-20 16:35:19 +00: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 04:58:11 +00: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 16:35:19 +00: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 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
1998-03-20 16:35:19 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1998-03-20 16:35:19 +00:00
|
|
|
|
2003-09-17 00:49:19 +00:00
|
|
|
#include <stddef.h>
|
2000-01-18 10:53:15 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/statfs.h>
|
1998-03-20 16:35:19 +00:00
|
|
|
#include <sys/statvfs.h>
|
|
|
|
|
2003-09-17 00:49:19 +00:00
|
|
|
extern void __internal_statvfs (const char *name, struct statvfs *buf,
|
2014-05-29 04:11:29 +00:00
|
|
|
struct statfs *fsbuf, int fd);
|
2003-09-17 00:49:19 +00:00
|
|
|
|
1998-03-20 16:35:19 +00:00
|
|
|
|
|
|
|
int
|
2015-06-09 19:52:01 +00:00
|
|
|
__statvfs (const char *file, struct statvfs *buf)
|
1998-03-20 16:35:19 +00:00
|
|
|
{
|
2000-01-18 10:17:32 +00:00
|
|
|
struct statfs fsbuf;
|
1998-03-20 16:35:19 +00:00
|
|
|
|
2000-01-18 10:17:32 +00:00
|
|
|
/* Get as much information as possible from the system. */
|
2000-01-18 10:53:15 +00:00
|
|
|
if (__statfs (file, &fsbuf) < 0)
|
1998-03-20 16:35:19 +00:00
|
|
|
return -1;
|
|
|
|
|
2003-09-17 00:49:19 +00:00
|
|
|
/* Convert the result. */
|
2014-05-29 04:11:29 +00:00
|
|
|
__internal_statvfs (file, buf, &fsbuf, -1);
|
2000-01-18 10:53:15 +00:00
|
|
|
|
2000-01-18 10:17:32 +00:00
|
|
|
/* We signal success if the statfs call succeeded. */
|
|
|
|
return 0;
|
1998-03-20 16:35:19 +00:00
|
|
|
}
|
2015-06-09 19:52:01 +00:00
|
|
|
weak_alias (__statvfs, statvfs)
|
|
|
|
libc_hidden_weak (statvfs)
|