diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2008-03-22 19:18:43 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2008-03-22 19:18:43 +0000 |
commit | 2068db5ce3fd5591f587c184b5e88f45b8f8328d (patch) | |
tree | b3a8fbcd737e5223a58c00b81a87f0a10e9b7730 /lib/libc/sys | |
parent | 8a3788f16668826aaed4f977cbcb571dcdcb1d02 (diff) |
move statvfs.c to gen, since it is not a syscall; ok deraadt@
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/sys/statvfs.c | 69 |
2 files changed, 2 insertions, 71 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 87c98516d2e..3813096d112 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.84 2008/03/16 19:44:34 otto Exp $ +# $OpenBSD: Makefile.inc,v 1.85 2008/03/22 19:18:42 otto Exp $ # $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $ # @(#)Makefile.inc 8.1 (Berkeley) 6/17/93 @@ -27,7 +27,7 @@ DPSRCS+= Lint_Ovfork.c Lint_brk.c Lint_exect.c Lint_fork.c \ # with old syscall interfaces. SRCS+= ftruncate.c lseek.c mquery.c mmap.c ptrace.c semctl.c truncate.c \ timer_create.c timer_delete.c timer_getoverrun.c timer_gettime.c \ - timer_settime.c pread.c preadv.c pwrite.c pwritev.c statvfs.c + timer_settime.c pread.c preadv.c pwrite.c pwritev.c # stack protector helper functions SRCS+= stack_protector.c diff --git a/lib/libc/sys/statvfs.c b/lib/libc/sys/statvfs.c deleted file mode 100644 index 34256b32a80..00000000000 --- a/lib/libc/sys/statvfs.c +++ /dev/null @@ -1,69 +0,0 @@ -/* $OpenBSD: statvfs.c,v 1.2 2008/03/16 19:46:14 deraadt Exp $ */ - -/* - * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/mount.h> -#include <sys/statvfs.h> - -static void -cvt_statfs_to_statvfs(const struct statfs *fsp, struct statvfs *vfsp) -{ - vfsp->f_bsize = fsp->f_iosize; /* XXX */ - vfsp->f_frsize = fsp->f_bsize; /* XXX */ - - vfsp->f_blocks = fsp->f_blocks; - vfsp->f_bfree = fsp->f_bfree; - vfsp->f_bavail = fsp->f_bavail < 0 ? 0 : fsp->f_bavail; - - vfsp->f_files = fsp->f_files; - vfsp->f_ffree = fsp->f_ffree; - vfsp->f_favail = fsp->f_favail < 0 ? 0 : fsp->f_favail; - - vfsp->f_fsid = fsp->f_fsid.val[0]; /* XXX */ - vfsp->f_flag = 0; - if (fsp->f_flags & MNT_RDONLY) - vfsp->f_flag |= ST_RDONLY; - if (fsp->f_flags & MNT_NOSUID) - vfsp->f_flag |= ST_NOSUID; - vfsp->f_namemax = fsp->f_namemax; -} - -int -fstatvfs(int fd, struct statvfs *p) -{ - struct statfs sb; - int ret; - - ret = fstatfs(fd, &sb); - if (ret == 0) - cvt_statfs_to_statvfs(&sb, p); - return (ret); -} - -int -statvfs(const char *path, struct statvfs *p) -{ - struct statfs sb; - int ret; - - ret = statfs(path, &sb); - if (ret == 0) - cvt_statfs_to_statvfs(&sb, p); - return (ret); -} - |