diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2015-04-15 09:13:11 +0000 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2015-04-15 09:13:11 +0000 |
commit | 1c73bcab8e2a921f60694caf1fa28469cf1d8673 (patch) | |
tree | 249a49d65c11cd971a440bb934014ef89449b2c2 /sys/kern/vfs_syscalls.c | |
parent | 1243a98e38a54709f670e748070f4051de2ad10f (diff) | |
download | src-test2-1c73bcab8e2a921f60694caf1fa28469cf1d8673.tar.gz src-test2-1c73bcab8e2a921f60694caf1fa28469cf1d8673.zip |
Notes
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 76a540f167c1..8c8ca3165c2c 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -434,9 +434,14 @@ sys_getfsstat(td, uap) int flags; } */ *uap; { + size_t count; + int error; - return (kern_getfsstat(td, &uap->buf, uap->bufsize, UIO_USERSPACE, - uap->flags)); + error = kern_getfsstat(td, &uap->buf, uap->bufsize, &count, + UIO_USERSPACE, uap->flags); + if (error == 0) + td->td_retval[0] = count; + return (error); } /* @@ -446,7 +451,7 @@ sys_getfsstat(td, uap) */ int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, - enum uio_seg bufseg, int flags) + size_t *countp, enum uio_seg bufseg, int flags) { struct mount *mp, *nmp; struct statfs *sfsp, *sp, sb; @@ -533,9 +538,9 @@ kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, } mtx_unlock(&mountlist_mtx); if (sfsp && count > maxcount) - td->td_retval[0] = maxcount; + *countp = maxcount; else - td->td_retval[0] = count; + *countp = count; return (0); } @@ -624,9 +629,9 @@ freebsd4_getfsstat(td, uap) count = uap->bufsize / sizeof(struct ostatfs); size = count * sizeof(struct statfs); - error = kern_getfsstat(td, &buf, size, UIO_SYSSPACE, uap->flags); + error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, + uap->flags); if (size > 0) { - count = td->td_retval[0]; sp = buf; while (count > 0 && error == 0) { cvtstatfs(sp, &osb); @@ -637,6 +642,8 @@ freebsd4_getfsstat(td, uap) } free(buf, M_TEMP); } + if (error == 0) + td->td_retval[0] = count; return (error); } |