Add handrolled stat30 compat syscalls for calling post-time_t rump
kernels from pre-time_t userlands.
This commit is contained in:
parent
ac42a021b0
commit
659f41e70a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rump.h,v 1.19 2009/05/22 08:34:14 pooka Exp $ */
|
||||
/* $NetBSD: rump.h,v 1.20 2009/05/22 08:59:32 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
@ -156,6 +156,12 @@ int rump_sysproxy_set(rump_sysproxy_t, void *);
|
||||
int rump_sysproxy_socket_setup_client(int);
|
||||
int rump_sysproxy_socket_setup_server(int);
|
||||
|
||||
/*
|
||||
* compat syscalls. these are currently hand-"generated"
|
||||
*/
|
||||
int rump_sys___stat30(const char *, struct stat *);
|
||||
int rump_sys___lstat30(const char *, struct stat *);
|
||||
|
||||
/*
|
||||
* Begin rump syscall conditionals. Yes, something a little better
|
||||
* is required here.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile.rumpvfs,v 1.6 2009/03/19 09:14:37 pooka Exp $
|
||||
# $NetBSD: Makefile.rumpvfs,v 1.7 2009/05/22 08:59:32 pooka Exp $
|
||||
#
|
||||
|
||||
.include "${RUMPTOP}/Makefile.rump"
|
||||
@ -8,7 +8,8 @@ LIB= rumpvfs
|
||||
.PATH: ${RUMPTOP}/librump/rumpvfs \
|
||||
${RUMPTOP}/../kern ${RUMPTOP}/../lib/libkern \
|
||||
${RUMPTOP}/../miscfs/genfs ${RUMPTOP}/../miscfs/syncfs \
|
||||
${RUMPTOP}/../miscfs/specfs
|
||||
${RUMPTOP}/../miscfs/specfs \
|
||||
${RUMPTOP}/../compat/common
|
||||
|
||||
#
|
||||
# Source modules, first the ones specifically implemented for librump.
|
||||
@ -32,6 +33,9 @@ SRCS+= genfs_vfsops.c genfs_vnops.c spec_vnops.c
|
||||
SRCS+= subr_bufq.c bufq_disksort.c bufq_fcfs.c bufq_priocscan.c \
|
||||
bufq_readprio.c
|
||||
|
||||
# compat syscalls
|
||||
SRCS+= vfs_syscalls_50.c compat.c
|
||||
|
||||
SRCS+= rumpvnode_if.c
|
||||
|
||||
# no shlib_version because this is automatically in sync with lib/librump
|
||||
|
86
sys/rump/librump/rumpvfs/compat.c
Normal file
86
sys/rump/librump/rumpvfs/compat.c
Normal file
@ -0,0 +1,86 @@
|
||||
/* $NetBSD: compat.c,v 1.1 2009/05/22 08:59:32 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
|
||||
*
|
||||
* Development of this software was supported by the Nokia Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
*
|
||||
* 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 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/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: compat.c,v 1.1 2009/05/22 08:59:32 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <rump/rump.h>
|
||||
#include <rump/rumpuser.h>
|
||||
|
||||
/*
|
||||
* XXX: these are handwritten for now. They provide compat for
|
||||
* calling post-time_t file systems from a pre-time_t userland.
|
||||
* (mknod is missing. I don't care very much)
|
||||
*
|
||||
* Doing remote system calls with these does not (obviously) work.
|
||||
*/
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#define SPARG(p,k) ((p)->k.be.datum)
|
||||
#else /* LITTLE_ENDIAN, I hope dearly */
|
||||
#define SPARG(p,k) ((p)->k.le.datum)
|
||||
#endif
|
||||
|
||||
int
|
||||
rump_sys___stat30(const char *path, struct stat *sb)
|
||||
{
|
||||
struct compat_50_sys___stat30_args args;
|
||||
register_t retval = 0;
|
||||
int error = 0;
|
||||
|
||||
SPARG(&args, path) = path;
|
||||
SPARG(&args, ub) = (struct stat30 *)sb;
|
||||
|
||||
error = compat_50_sys___stat30(curlwp, &args, &retval);
|
||||
if (error) {
|
||||
retval = -1;
|
||||
rumpuser_seterrno(error);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int
|
||||
rump_sys___lstat30(const char *path, struct stat *sb)
|
||||
{
|
||||
struct compat_50_sys___lstat30_args args;
|
||||
register_t retval = 0;
|
||||
int error = 0;
|
||||
|
||||
SPARG(&args, path) = path;
|
||||
SPARG(&args, ub) = (struct stat30 *)sb;
|
||||
|
||||
error = compat_50_sys___lstat30(curlwp, &args, &retval);
|
||||
if (error) {
|
||||
retval = -1;
|
||||
rumpuser_seterrno(error);
|
||||
}
|
||||
return retval;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user