diff options
author | Brad Smith <brad@cvs.openbsd.org> | 1999-10-07 17:23:54 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 1999-10-07 17:23:54 +0000 |
commit | a1088c6616f8a77bc5c5fd38a08fd99af61853dc (patch) | |
tree | 3fa892330044c53afb642a24d5293af29f32f846 | |
parent | ff5c80ff74db4e82ba664c9b3e079048d5688f69 (diff) |
- fix typo in previous commit
- Implement fstatvfs64 system call
-rw-r--r-- | sys/compat/svr4/svr4_misc.c | 66 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_statvfs.h | 86 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_types.h | 13 | ||||
-rw-r--r-- | sys/compat/svr4/syscalls.master | 5 |
4 files changed, 131 insertions, 39 deletions
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index b9d75dce263..925aaec987e 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_misc.c,v 1.24 1999/10/07 16:14:28 brad Exp $ */ +/* $OpenBSD: svr4_misc.c,v 1.25 1999/10/07 17:23:53 brad Exp $ */ /* $NetBSD: svr4_misc.c,v 1.42 1996/12/06 03:22:34 christos Exp $ */ /* @@ -96,9 +96,11 @@ static int svr4_setinfo __P((struct proc *, int, svr4_siginfo_t *)); struct svr4_hrtcntl_args; static int svr4_hrtcntl __P((struct proc *, struct svr4_hrtcntl_args *, - register_t *)); + register_t *)); static void bsd_statfs_to_svr4_statvfs __P((const struct statfs *, - struct svr4_statvfs *)); + struct svr4_statvfs *)); +static void bsd_statfs_to_svr4_statvfs64 __P((const struct statfs *, + struct svr4_statvfs64 *)); static struct proc *svr4_pfind __P((pid_t pid)); static int svr4_mknod __P((struct proc *, register_t *, char *, @@ -450,7 +452,7 @@ svr4_sys_xmknod(p, v, retval) struct svr4_sys_xmknod_args *uap = v; return svr4_mknod(p, retval, SCARG(uap, path), SCARG(uap, mode), - svr4_to_bsd_odev_t(SCARG(uap, dev))); + svr4_to_bsd_dev_t(SCARG(uap, dev))); } @@ -1167,6 +1169,32 @@ bsd_statfs_to_svr4_statvfs(bfs, sfs) } +static void +bsd_statfs_to_svr4_statvfs64(bfs, sfs) + const struct statfs *bfs; + struct svr4_statvfs64 *sfs; +{ + sfs->f_bsize = bfs->f_iosize; /* XXX */ + sfs->f_frsize = bfs->f_bsize; + sfs->f_blocks = bfs->f_blocks; + sfs->f_bfree = bfs->f_bfree; + sfs->f_bavail = bfs->f_bavail; + sfs->f_files = bfs->f_files; + sfs->f_ffree = bfs->f_ffree; + sfs->f_favail = bfs->f_ffree; + sfs->f_fsid = bfs->f_fsid.val[0]; + bcopy(bfs->f_fstypename, sfs->f_basetype, sizeof(sfs->f_basetype)); + sfs->f_flag = 0; + if (bfs->f_flags & MNT_RDONLY) + sfs->f_flag |= SVR4_ST_RDONLY; + if (bfs->f_flags & MNT_NOSUID) + sfs->f_flag |= SVR4_ST_NOSUID; + sfs->f_namemax = MAXNAMLEN; + bcopy(bfs->f_fstypename, sfs->f_fstr, sizeof(sfs->f_fstr)); /* XXX */ + bzero(sfs->f_filler, sizeof(sfs->f_filler)); +} + + int svr4_sys_statvfs(p, v, retval) register struct proc *p; @@ -1225,6 +1253,36 @@ svr4_sys_fstatvfs(p, v, retval) return copyout(&sfs, SCARG(uap, fs), sizeof(sfs)); } + +int +svr4_sys_fstatvfs64(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + struct svr4_sys_fstatvfs64_args *uap = v; + struct sys_fstatfs_args fs_args; + caddr_t sg = stackgap_init(p->p_emul); + struct statfs *fs = stackgap_alloc(&sg, sizeof(struct statfs)); + struct statfs bfs; + struct svr4_statvfs64 sfs; + int error; + + SCARG(&fs_args, fd) = SCARG(uap, fd); + SCARG(&fs_args, buf) = fs; + + if ((error = sys_fstatfs(p, &fs_args, retval)) != 0) + return error; + + if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0) + return error; + + bsd_statfs_to_svr4_statvfs64(&bfs, &sfs); + + return copyout(&sfs, SCARG(uap, fs), sizeof(sfs)); +} + + int svr4_sys_alarm(p, v, retval) register struct proc *p; diff --git a/sys/compat/svr4/svr4_statvfs.h b/sys/compat/svr4/svr4_statvfs.h index 7ddaf1c9842..5a88ef7d808 100644 --- a/sys/compat/svr4/svr4_statvfs.h +++ b/sys/compat/svr4/svr4_statvfs.h @@ -1,10 +1,13 @@ -/* $OpenBSD: svr4_statvfs.h,v 1.2 1996/08/02 20:35:42 niklas Exp $ */ -/* $NetBSD: svr4_statvfs.h,v 1.1 1995/01/08 21:31:39 christos Exp $ */ +/* $OpenBSD: svr4_statvfs.h,v 1.3 1999/10/07 17:23:53 brad Exp $ */ +/* $NetBSD: svr4_statvfs.h,v 1.3 1998/09/04 19:54:40 christos Exp $ */ -/* - * Copyright (c) 1994 Christos Zoulas +/*- + * Copyright (c) 1994 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,41 +16,64 @@ * 2. 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. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. */ #ifndef _SVR4_STATVFS_H_ #define _SVR4_STATVFS_H_ typedef struct svr4_statvfs { - u_long f_bsize; - u_long f_frsize; - u_long f_blocks; - u_long f_bfree; - u_long f_bavail; - u_long f_files; - u_long f_ffree; - u_long f_favail; - u_long f_fsid; - char f_basetype[16]; - u_long f_flag; - u_long f_namemax; - char f_fstr[32]; - u_long f_filler[16]; + u_long f_bsize; + u_long f_frsize; + svr4_fsblkcnt_t f_blocks; + svr4_fsblkcnt_t f_bfree; + svr4_fsblkcnt_t f_bavail; + svr4_fsblkcnt_t f_files; + svr4_fsblkcnt_t f_ffree; + svr4_fsblkcnt_t f_favail; + u_long f_fsid; + char f_basetype[16]; + u_long f_flag; + u_long f_namemax; + char f_fstr[32]; + u_long f_filler[16]; } svr4_statvfs_t; +typedef struct svr4_statvfs64 { + u_long f_bsize; + u_long f_frsize; + svr4_fsblkcnt64_t f_blocks; + svr4_fsblkcnt64_t f_bfree; + svr4_fsblkcnt64_t f_bavail; + svr4_fsblkcnt64_t f_files; + svr4_fsblkcnt64_t f_ffree; + svr4_fsblkcnt64_t f_favail; + u_long f_fsid; + char f_basetype[16]; + u_long f_flag; + u_long f_namemax; + char f_fstr[32]; + u_long f_filler[16]; +} svr4_statvfs64_t; + #define SVR4_ST_RDONLY 0x01 #define SVR4_ST_NOSUID 0x02 #define SVR4_ST_NOTRUNC 0x04 diff --git a/sys/compat/svr4/svr4_types.h b/sys/compat/svr4/svr4_types.h index b40939cfd42..5772af7e821 100644 --- a/sys/compat/svr4/svr4_types.h +++ b/sys/compat/svr4/svr4_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_types.h,v 1.4 1999/10/07 16:14:28 brad Exp $ */ +/* $OpenBSD: svr4_types.h,v 1.5 1999/10/07 17:23:53 brad Exp $ */ /* $NetBSD: svr4_types.h,v 1.11 1998/09/11 12:34:46 mycroft Exp $ */ /*- @@ -72,11 +72,18 @@ typedef int svr4_key_t; typedef struct timespec svr4_timestruc_t; +#define svr4_omajor(x) ((int32_t)((((x) & 0x7f00) >> 8))) +#define svr4_ominor(x) ((int32_t)((((x) & 0x00ff) >> 0))) +#define svr4_omakedev(x,y) ((svr4_o_dev_t)((((x) << 8) & 0x7f00) | \ + (((y) << 0) & 0x00ff))) +#define svr4_to_bsd_odev_t(d) makedev(svr4_omajor(d), svr4_ominor(d)) #define bsd_to_svr4_odev_t(d) svr4_omakedev(major(d), minor(d)) -#define svr4_makedev(x,y) ((svr4_dev_t)((((x) << 18) & 0xfffc0000) | \ +#define svr4_major(x) ((int32_t)((((x) & 0xfffc0000) >> 18))) +#define svr4_minor(x) ((int32_t)((((x) & 0x0003ffff) >> 0))) +#define svr4_makedev(x,y) ((svr4_dev_t)((((x) << 18) & 0xfffc0000) | \ (((y) << 0) & 0x0003ffff))) - +#define svr4_to_bsd_dev_t(d) makedev(svr4_major(d), svr4_minor(d)) #define bsd_to_svr4_dev_t(d) svr4_makedev(major(d), minor(d)) #endif /* !_SVR4_TYPES_H_ */ diff --git a/sys/compat/svr4/syscalls.master b/sys/compat/svr4/syscalls.master index 1cfe8aed631..749e6e0835d 100644 --- a/sys/compat/svr4/syscalls.master +++ b/sys/compat/svr4/syscalls.master @@ -1,4 +1,4 @@ - $OpenBSD: syscalls.master,v 1.25 1999/10/07 16:14:28 brad Exp $ + $OpenBSD: syscalls.master,v 1.26 1999/10/07 17:23:53 brad Exp $ ; $NetBSD: syscalls.master,v 1.17 1996/02/10 17:12:51 christos Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -329,7 +329,8 @@ 217 STD { int svr4_sys_fstat64(int fd, \ struct svr4_stat64 *sb); } 218 UNIMPL statvfs64 -219 UNIMPL fstatvfs64 +219 STD { int svr4_sys_fstatvfs64(int fd, \ + struct svr4_statvfs64 *fs); } 220 UNIMPL setrlimit64 221 UNIMPL getrlimit64 222 UNIMPL pread64 |