Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/kern/lib/libsys_linux Add the first attempt at rump...
details: https://anonhg.NetBSD.org/src/rev/9b1ea45a31aa
branches: trunk
changeset: 781645:9b1ea45a31aa
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Sep 19 21:45:40 2012 +0000
description:
Add the first attempt at rump kernel support for Linux clients. This has
been lightly tested with unmodified networking applications with both
the client and server on a 64bit le host. Unlike the standard Linux
compat libs where args and syscalls are swizzled around, this compat
lib only massages the arg data types due to the assumption that syscall
numbers come from librumpclient (via librumphijack) and therefore match
the native NetBSD numbers.
diffstat:
sys/rump/kern/lib/libsys_linux/Makefile | 19 +
sys/rump/kern/lib/libsys_linux/component.c | 44 +
sys/rump/kern/lib/libsys_linux/shlib_version | 4 +
sys/rump/kern/lib/libsys_linux/syscalls.conf | 16 +
sys/rump/kern/lib/libsys_linux/syscalls.master | 604 +++++++++++++++++++++++++
5 files changed, 687 insertions(+), 0 deletions(-)
diffs (truncated from 707 to 300 lines):
diff -r 5966b59c39c9 -r 9b1ea45a31aa sys/rump/kern/lib/libsys_linux/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/kern/lib/libsys_linux/Makefile Wed Sep 19 21:45:40 2012 +0000
@@ -0,0 +1,19 @@
+# $NetBSD: Makefile,v 1.1 2012/09/19 21:45:40 pooka Exp $
+#
+
+.PATH: ${.CURDIR}/../../../../compat/linux/common
+
+LIB= rumpkern_sys_linux
+
+SRCS= linux_blkio.c linux_cdrom.c linux_errno.c linux_fdio.c \
+ linux_file.c linux_hdio.c linux_ioctl.c linux_ipc.c linux_misc.c\
+ linux_mtio.c linux_signal.c linux_signo.c linux_socket.c \
+ linux_sysctl.c linux_termios.c linux_time.c linux_file64.c
+
+SRCS+= rump_linux_sysent.c component.c
+
+# XXX
+CPPFLAGS+= -I${.CURDIR}
+
+.include <bsd.lib.mk>
+.include <bsd.klinks.mk>
diff -r 5966b59c39c9 -r 9b1ea45a31aa sys/rump/kern/lib/libsys_linux/component.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/kern/lib/libsys_linux/component.c Wed Sep 19 21:45:40 2012 +0000
@@ -0,0 +1,44 @@
+/* $NetBSD: component.c,v 1.1 2012/09/19 21:45:40 pooka Exp $ */
+
+#include <sys/param.h>
+#include <sys/proc.h>
+
+#include "rump_private.h"
+
+extern struct sysent rump_linux_sysent[];
+
+struct emul emul_rump_sys_linux = {
+ .e_name = "linux-rump",
+ .e_sysent = rump_linux_sysent,
+ .e_vm_default_addr = uvm_default_mapaddr,
+#ifdef __HAVE_SYSCALL_INTERN
+ .e_syscall_intern = syscall_intern,
+#endif
+};
+
+/*
+ * XXX: the linux emulation code is not split into factions
+ */
+void rumplinux__stub(void);
+void rumplinux__stub(void) {panic("unavailable");}
+__weak_alias(rumpns_linux_machdepioctl,rumplinux__stub);
+__weak_alias(rumpns_nanosleep1,rumplinux__stub);
+__weak_alias(rumpns_vm_map_unlock,rumplinux__stub);
+__weak_alias(rumpns_compat_50_sys_settimeofday,rumplinux__stub);
+__weak_alias(rumpns_oss_ioctl_mixer,rumplinux__stub);
+__weak_alias(rumpns_linux_ioctl_sg,rumplinux__stub);
+__weak_alias(rumpns_oss_ioctl_sequencer,rumplinux__stub);
+__weak_alias(rumpns_uvm_mremap,rumplinux__stub);
+__weak_alias(rumpns_sysent,rumplinux__stub);
+__weak_alias(rumpns_sys_swapctl,rumplinux__stub);
+__weak_alias(rumpns_vm_map_lock,rumplinux__stub);
+__weak_alias(rumpns_compat_50_sys_gettimeofday,rumplinux__stub);
+__weak_alias(rumpns_rusage_to_rusage50,rumplinux__stub);
+__weak_alias(rumpns_sys_obreak,rumplinux__stub);
+__weak_alias(rumpns_do_sys_wait,rumplinux__stub);
+__weak_alias(rumpns_sys_mmap,rumplinux__stub);
+__weak_alias(rumpns_oss_ioctl_audio,rumplinux__stub);
+__weak_alias(rumpns_clock_gettime1,rumplinux__stub);
+__weak_alias(rumpns_uvm_map_lookup_entry,rumplinux__stub);
+__weak_alias(rumpns_clock_settime1,rumplinux__stub);
+__weak_alias(rumpns_clock_getres1,rumplinux__stub);
diff -r 5966b59c39c9 -r 9b1ea45a31aa sys/rump/kern/lib/libsys_linux/shlib_version
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/kern/lib/libsys_linux/shlib_version Wed Sep 19 21:45:40 2012 +0000
@@ -0,0 +1,4 @@
+# $NetBSD: shlib_version,v 1.1 2012/09/19 21:45:40 pooka Exp $
+#
+major=0
+minor=0
diff -r 5966b59c39c9 -r 9b1ea45a31aa sys/rump/kern/lib/libsys_linux/syscalls.conf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/kern/lib/libsys_linux/syscalls.conf Wed Sep 19 21:45:40 2012 +0000
@@ -0,0 +1,16 @@
+# $NetBSD: syscalls.conf,v 1.1 2012/09/19 21:45:40 pooka Exp $
+#
+
+sysnames="rump_linux_syscalls.c"
+sysnumhdr="/dev/null"
+syssw="rump_linux_sysent.c"
+sysarghdr="rump_linux_syscallargs.h"
+compatopts=""
+libcompatopts=""
+
+switchname="rump_linux_sysent"
+namesname="rump_linux_syscallnames"
+constprefix="RUMP_LINUX_SYS_"
+nsysent=512
+
+sys_nosys="linux_sys_nosys"
diff -r 5966b59c39c9 -r 9b1ea45a31aa sys/rump/kern/lib/libsys_linux/syscalls.master
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/kern/lib/libsys_linux/syscalls.master Wed Sep 19 21:45:40 2012 +0000
@@ -0,0 +1,604 @@
+ $NetBSD: syscalls.master,v 1.1 2012/09/19 21:45:40 pooka Exp $
+
+; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
+
+; NetBSD system call name/number "master" file.
+; (See syscalls.conf to see what it is processed into.)
+;
+; Fields: number type [type-dependent ...]
+; number system call number, must be in order
+; type one of NODEF, UNIMPL, or NOARGS
+;
+; types:
+; NODEF always included
+; UNIMPL unimplemented, not included in system
+; NODEF included, but don't define the syscall number
+; NOARGS included, but don't define the syscall args structure
+;
+; arguments:
+; PAD argument not part of the C interface, used only for padding
+;
+;
+; The purpose of this syscalls.master is to map to the Linux types which
+; are marshalled into the arg structure by the clientside rump_syscalls.c
+; code in librumpclient.
+;
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/signal.h>
+#include <sys/socket.h>
+#include <sys/mount.h>
+#include <sys/sched.h>
+#include <sys/syscallargs.h>
+
+#include <compat/linux/common/linux_types.h>
+#include <compat/linux/common/linux_signal.h>
+
+#include "rump_linux_syscallargs.h"
+
+%%
+
+0 NOARGS { int|linux_sys||nosys(void); }
+1 UNIMPL exit
+2 UNIMPL fork
+3 NOARGS { ssize_t|sys||read(int fd, void *buf, size_t nbyte); }
+4 NOARGS { ssize_t|sys||write(int fd, const void *buf, \
+ size_t nbyte); }
+5 NODEF { int|linux_sys||open(const char *path, \
+ int flags, int mode); }
+6 NOARGS { int|sys||close(int fd); }
+7 UNIMPL wait4
+8 UNIMPL creat
+9 NOARGS { int|sys||link(const char *path, const char *link); }
+10 NODEF { int|linux_sys||unlink(const char *path); }
+11 UNIMPL execv
+12 NOARGS { int|sys||chdir(const char *path); }
+13 NOARGS { int|sys||fchdir(int fd); }
+14 UNIMPL mknod
+15 NOARGS { int|sys||chmod(const char *path, mode_t mode); }
+16 NOARGS { int|sys||__posix_chown(const char *path, uid_t uid, \
+ gid_t gid); }
+17 UNIMPL obreak
+18 UNIMPL getfsstat
+19 UNIMPL lseek
+20 NOARGS { pid_t|sys||getpid_with_ppid(void); } getpid
+21 UNIMPL mount
+22 UNIMPL unmount
+23 NOARGS { int|sys||setuid(uid_t uid); }
+24 NOARGS { uid_t|sys||getuid_with_euid(void); } getuid
+25 NOARGS { uid_t|sys||geteuid(void); }
+26 UNIMPL ptrace
+27 NODEF { ssize_t|linux_sys||recvmsg(int s, \
+ struct linux_msghdr *msg, int flags); }
+28 NODEF { ssize_t|linux_sys||sendmsg(int s, \
+ const struct linux_msghdr *msg, int flags); }
+29 NODEF { ssize_t|linux_sys||recvfrom(int s, void *buf, \
+ int len, int flags, struct osockaddr *from, \
+ int *fromlenaddr); }
+30 NODEF { int|linux_sys||accept(int s, struct osockaddr *name, \
+ int *anamelen); }
+31 NODEF { int|linux_sys||getpeername(int fdes, \
+ struct osockaddr *asa, int *alen); }
+32 NODEF { int|linux_sys||getsockname(int fdes, \
+ struct osockaddr *asa, int *alen); }
+33 NOARGS { int|sys||access(const char *path, int flags); }
+34 UNIMPL chflags
+35 UNIMPL fchflags
+36 NOARGS { void|sys||sync(void); }
+37 UNIMPL kill
+38 UNIMPL stat
+39 UNIMPL getppid
+40 UNIMPL lstat
+41 NOARGS { int|sys||dup(int fd); }
+
+; we mimic the librumpclient calling convention, therefore no linux_sys_pipe
+42 NOARGS { int|sys||pipe(void); }
+
+43 UNIMPL getegid
+44 UNIMPL profil
+45 UNIMPL ktrace
+46 UNIMPL sigaction
+47 NOARGS { gid_t|sys||getgid_with_egid(void); } getgid
+48 UNIMPL sigprocmask
+49 UNIMPL __getlogin
+50 UNIMPL __setlogin
+51 UNIMPL acct
+52 UNIMPL sigpending
+53 UNIMPL sigaltstack
+54 NODEF { int|linux_sys||ioctl(int fd, \
+ u_long com, void *data); }
+55 UNIMPL reboot
+56 UNIMPL revoke
+57 NOARGS { int|sys||symlink(const char *path, \
+ const char *link); }
+58 NOARGS { ssize_t|sys||readlink(const char *path, char *buf, \
+ int count); }
+59 UNIMPL execve
+60 NOARGS { mode_t|sys||umask(mode_t newmask); }
+61 NOARGS { int|sys||chroot(const char *path); }
+62 UNIMPL fstat43
+63 UNIMPL getkerninfo
+64 UNIMPL getpagesize
+65 UNIMPL msync
+66 UNIMPL vfork
+67 UNIMPL vread
+68 UNIMPL vwrite
+69 UNIMPL sbrk
+70 UNIMPL sstk
+71 UNIMPL mmap
+72 UNIMPL ovadvise
+73 UNIMPL munmap
+74 UNIMPL mprotect
+75 UNIMPL madvise
+76 UNIMPL vhangup
+77 UNIMPL vlimit
+78 UNIMPL mincore
+79 NOARGS { int|sys||getgroups(int gidsetsize, \
+ int *gidset); }
+80 NOARGS { int|sys||setgroups(int gidsetsize, \
+ const int *gidset); }
+81 NOARGS { int|sys||getpgrp(void); }
+82 NOARGS { int|sys||setpgid(int pid, int pgid); }
+83 UNIMPL setitimer
+84 UNIMPL wait
+85 UNIMPL swapon
+86 UNIMPL getitimer
+87 UNIMPL gethostname
+88 UNIMPL sethostname
+89 UNIMPL getdtablesize
+90 NOARGS { int|sys||dup2(int from, int to); }
+91 UNIMPL getdopt
+92 NODEF { int|linux_sys||fcntl(int fd, int cmd, void *arg); }
+93 UNIMPL select
+94 UNIMPL setdopt
+95 NOARGS { int|sys||fsync(int fd); }
+96 UNIMPL setpriority
+97 UNIMPL socket
+98 NODEF { int|linux_sys||connect(int s, \
+ const struct osockaddr *name, \
+ unsigned int namelen); }
+99 UNIMPL accept
+100 UNIMPL getpriority
+
+101 UNIMPL send
+102 UNIMPL recv
+
+103 UNIMPL sigreturn
+104 NODEF { int|linux_sys||bind(int s, \
+ const struct osockaddr *name, unsigned namelen); }
+105 NODEF { int|linux_sys||setsockopt(int s, int level, \
+ int name, const void *val, int optlen); }
+106 NOARGS { int|sys||listen(int s, int backlog); }
+107 UNIMPL vtimes
+108 UNIMPL sigvec
+109 UNIMPL sigblock
+110 UNIMPL sigsetmask
+111 UNIMPL sigsuspend
+112 UNIMPL sigstack
+113 UNIMPL orecvmsg
+114 UNIMPL osendmsg
+115 UNIMPL vtrace
+116 UNIMPL gettimeofday
+117 UNIMPL getrusage
+118 NODEF { int|linux_sys||getsockopt(int s, int level, \
+ int name, void *val, int *avalsize); }
+119 UNIMPL resuba
+120 NOARGS { ssize_t|sys||readv(int fd, \
+ const struct iovec *iovp, int iovcnt); }
+121 NOARGS { ssize_t|sys||writev(int fd, \
+ const struct iovec *iovp, int iovcnt); }
+122 UNIMPL settimeofday
+123 NOARGS { int|sys||__posix_fchown(int fd, int uid, int gid); }
+124 NOARGS { int|sys||fchmod(int fd, mode_t mode); }
+125 UNIMPL orecvfrom
+126 NOARGS { int|sys||setreuid(uid_t ruid, uid_t euid); }
+127 NOARGS { int|sys||setregid(gid_t rgid, gid_t egid); }
+128 NOARGS { int|sys||__posix_rename(const char *from, \
Home |
Main Index |
Thread Index |
Old Index