libc: fix fstatfs() implementation.

The syscall expects the size of the buffer as the second argument.

Change-Id: I99ede2fec7fcd385ca03ff022c2cffa4297bea8d
This commit is contained in:
David 'Digit' Turner 2010-07-08 16:52:27 -07:00
parent d466780c7c
commit ab8b54101e
11 changed files with 52 additions and 14 deletions

View file

@ -14,6 +14,7 @@ libc_common_src_files := \
unistd/exec.c \
unistd/fcntl.c \
unistd/fnmatch.c \
unistd/fstatfs.c \
unistd/ftime.c \
unistd/ftok.c \
unistd/getcwd.c \

View file

@ -120,7 +120,7 @@ int fsync(int) 118
int fchown:fchown32(int, uid_t, gid_t) 207
void sync(void) 36
int __fcntl64:fcntl64(int, int, void *) 221
int fstatfs:fstatfs64(int, size_t, struct statfs *) 267,269
int __fstatfs64:fstatfs64(int, size_t, struct statfs *) 267,269
ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) 187
int fstatat:fstatat64(int dirfd, const char *path, struct stat *buf, int flags) 327,300
int mkdirat(int dirfd, const char *pathname, mode_t mode) 323,296

View file

@ -74,7 +74,7 @@ syscall_src += arch-arm/syscalls/fsync.S
syscall_src += arch-arm/syscalls/fchown.S
syscall_src += arch-arm/syscalls/sync.S
syscall_src += arch-arm/syscalls/__fcntl64.S
syscall_src += arch-arm/syscalls/fstatfs.S
syscall_src += arch-arm/syscalls/__fstatfs64.S
syscall_src += arch-arm/syscalls/sendfile.S
syscall_src += arch-arm/syscalls/fstatat.S
syscall_src += arch-arm/syscalls/mkdirat.S

View file

@ -2,12 +2,12 @@
#include <sys/linux-syscalls.h>
.text
.type fstatfs, #function
.globl fstatfs
.type __fstatfs64, #function
.globl __fstatfs64
.align 4
.fnstart
fstatfs:
__fstatfs64:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_fstatfs64

View file

@ -77,7 +77,7 @@ syscall_src += arch-sh/syscalls/fsync.S
syscall_src += arch-sh/syscalls/fchown.S
syscall_src += arch-sh/syscalls/sync.S
syscall_src += arch-sh/syscalls/__fcntl64.S
syscall_src += arch-sh/syscalls/fstatfs.S
syscall_src += arch-sh/syscalls/__fstatfs64.S
syscall_src += arch-sh/syscalls/sendfile.S
syscall_src += arch-sh/syscalls/fstatat.S
syscall_src += arch-sh/syscalls/mkdirat.S

View file

@ -2,11 +2,11 @@
#include <sys/linux-syscalls.h>
.text
.type fstatfs, @function
.globl fstatfs
.type __fstatfs64, @function
.globl __fstatfs64
.align 4
fstatfs:
__fstatfs64:
/* invoke trap */
mov.l 0f, r3 /* trap num */

View file

@ -77,7 +77,7 @@ syscall_src += arch-x86/syscalls/fsync.S
syscall_src += arch-x86/syscalls/fchown.S
syscall_src += arch-x86/syscalls/sync.S
syscall_src += arch-x86/syscalls/__fcntl64.S
syscall_src += arch-x86/syscalls/fstatfs.S
syscall_src += arch-x86/syscalls/__fstatfs64.S
syscall_src += arch-x86/syscalls/sendfile.S
syscall_src += arch-x86/syscalls/fstatat.S
syscall_src += arch-x86/syscalls/mkdirat.S

View file

@ -2,11 +2,11 @@
#include <sys/linux-syscalls.h>
.text
.type fstatfs, @function
.globl fstatfs
.type __fstatfs64, @function
.globl __fstatfs64
.align 4
fstatfs:
__fstatfs64:
pushl %ebx
pushl %ecx
pushl %edx

View file

@ -63,6 +63,8 @@ Differences between current and Android 2.2:
- <sys/select.h>: add missing declaration for pselect()
- <sys/vfs.h>: fixed implementation of fstatfs() (also fixes fpathconf()
which uses it).
-------------------------------------------------------------------------------
Differences between Android 2.2. and Android 2.1:

View file

@ -87,7 +87,7 @@ int fsync (int);
int fchown (int, uid_t, gid_t);
void sync (void);
int __fcntl64 (int, int, void *);
int fstatfs (int, size_t, struct statfs *);
int __fstatfs64 (int, size_t, struct statfs *);
ssize_t sendfile (int out_fd, int in_fd, off_t *offset, size_t count);
int fstatat (int dirfd, const char *path, struct stat *buf, int flags);
int mkdirat (int dirfd, const char *pathname, mode_t mode);

35
libc/unistd/fstatfs.c Normal file
View file

@ -0,0 +1,35 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/vfs.h>
extern int __fstatfs64(int, size_t, struct statfs *);
int fstatfs(int fd, struct statfs* stat)
{
return __fstatfs64(fd, sizeof(struct statfs), stat);
}