Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpkern Use kern_proc.c instead of a colle...
details: https://anonhg.NetBSD.org/src/rev/afa1208263ee
branches: trunk
changeset: 755592:afa1208263ee
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Jun 10 21:40:42 2010 +0000
description:
Use kern_proc.c instead of a collection of stubs. But what we
really wanted from this commit was the support for proc_specificdata.
TODO: make creating a new process actually use kern_proc and
maybe even add an interface which starts a process with
"any pid you don't like"
diffstat:
sys/rump/librump/rumpkern/Makefile.rumpkern | 8 +-
sys/rump/librump/rumpkern/emul.c | 83 +++++-----------------------
sys/rump/librump/rumpkern/rump.c | 48 +++++-----------
sys/rump/librump/rumpkern/rump_private.h | 7 +-
sys/rump/librump/rumpkern/rumpcopy.c | 14 ++--
sys/rump/librump/rumpkern/signals.c | 11 +++-
sys/rump/librump/rumpkern/vm.c | 42 ++++++++++++--
7 files changed, 90 insertions(+), 123 deletions(-)
diffs (truncated from 516 to 300 lines):
diff -r 550c64443253 -r afa1208263ee sys/rump/librump/rumpkern/Makefile.rumpkern
--- a/sys/rump/librump/rumpkern/Makefile.rumpkern Thu Jun 10 20:54:53 2010 +0000
+++ b/sys/rump/librump/rumpkern/Makefile.rumpkern Thu Jun 10 21:40:42 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.rumpkern,v 1.88 2010/06/06 20:09:38 njoly Exp $
+# $NetBSD: Makefile.rumpkern,v 1.89 2010/06/10 21:40:42 pooka Exp $
#
.include "${RUMPTOP}/Makefile.rump"
@@ -47,9 +47,9 @@
# sys/kern
SRCS+= init_sysctl_base.c kern_auth.c kern_descrip.c kern_event.c \
kern_hook.c kern_ksyms.c kern_malloc_stdtype.c kern_module.c \
- kern_mutex_obj.c kern_ntptime.c kern_rate.c kern_resource.c \
- kern_stub.c kern_syscall.c kern_sysctl.c kern_tc.c \
- kern_timeout.c kern_uidinfo.c param.c sys_descrip.c \
+ kern_mutex_obj.c kern_ntptime.c kern_proc.c kern_rate.c \
+ kern_resource.c kern_stub.c kern_syscall.c kern_sysctl.c \
+ kern_tc.c kern_timeout.c kern_uidinfo.c param.c sys_descrip.c \
sys_generic.c sys_module.c sys_pipe.c sys_select.c syscalls.c
# sys/kern subr (misc)
diff -r 550c64443253 -r afa1208263ee sys/rump/librump/rumpkern/emul.c
--- a/sys/rump/librump/rumpkern/emul.c Thu Jun 10 20:54:53 2010 +0000
+++ b/sys/rump/librump/rumpkern/emul.c Thu Jun 10 21:40:42 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emul.c,v 1.137 2010/05/11 20:25:14 pooka Exp $ */
+/* $NetBSD: emul.c,v 1.138 2010/06/10 21:40:42 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.137 2010/05/11 20:25:14 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.138 2010/06/10 21:40:42 pooka Exp $");
#include <sys/param.h>
#include <sys/null.h>
@@ -42,7 +42,6 @@
#include <sys/device.h>
#include <sys/queue.h>
#include <sys/file.h>
-#include <sys/filedesc.h>
#include <sys/cpu.h>
#include <sys/kmem.h>
#include <sys/poll.h>
@@ -62,7 +61,6 @@
#include "rump_private.h"
-kmutex_t *proc_lock;
struct lwp lwp0;
struct vnode *rootvp;
dev_t rootdev = NODEV;
@@ -114,28 +112,12 @@
.e_name = "netbsd-rump",
.e_sysent = rump_sysent,
.e_vm_default_addr = uvm_default_mapaddr,
+#ifdef __HAVE_SYSCALL_INTERN
+ .e_syscall_intern = syscall_intern,
+#endif
};
-struct proc *
-p_find(pid_t pid, uint flags)
-{
-
- panic("%s: not implemented", __func__);
-}
-
-struct pgrp *
-pg_find(pid_t pid, uint flags)
-{
-
- panic("%s: not implemented", __func__);
-}
-
-int
-pgid_in_session(struct proc *p, pid_t pg_id)
-{
-
- panic("%s: not implemented", __func__);
-}
+u_int nprocs = 1;
int
kpause(const char *wmesg, bool intr, int timeo, kmutex_t *mtx)
@@ -188,27 +170,6 @@
/* always sleepable, although we should improve this */
}
-int
-proc_uidmatch(kauth_cred_t cred, kauth_cred_t target)
-{
-
- panic("%s: not implemented", __func__);
-}
-
-void
-proc_crmod_enter(void)
-{
-
- panic("%s: not implemented", __func__);
-}
-
-void
-proc_crmod_leave(kauth_cred_t c1, kauth_cred_t c2, bool sugid)
-{
-
- panic("%s: not implemented", __func__);
-}
-
void
module_init_md(void)
{
@@ -236,29 +197,6 @@
}
void (*delay_func)(unsigned int) = rump_delay;
-void
-proc_sesshold(struct session *ss)
-{
-
- panic("proc_sesshold() impossible, session %p", ss);
-}
-
-void
-proc_sessrele(struct session *ss)
-{
-
- panic("proc_sessrele() impossible, session %p", ss);
-}
-
-int
-proc_vmspace_getref(struct proc *p, struct vmspace **vm)
-{
-
- /* XXX */
- *vm = p->p_vmspace;
- return 0;
-}
-
int
ttycheckoutq(struct tty *tp, int wait)
{
@@ -298,3 +236,12 @@
/* this function is __dead, we must exit */
rumpuser_exit(0);
}
+
+#ifdef __HAVE_SYSCALL_INTERN
+void
+syscall_intern(struct proc *p)
+{
+
+ /* no you don't */
+}
+#endif
diff -r 550c64443253 -r afa1208263ee sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c Thu Jun 10 20:54:53 2010 +0000
+++ b/sys/rump/librump/rumpkern/rump.c Thu Jun 10 21:40:42 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump.c,v 1.177 2010/06/09 14:08:17 pooka Exp $ */
+/* $NetBSD: rump.c,v 1.178 2010/06/10 21:40:42 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.177 2010/06/09 14:08:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.178 2010/06/10 21:40:42 pooka Exp $");
#include <sys/systm.h>
#define ELFSIZE ARCH_ELFSIZE
@@ -84,7 +84,7 @@
#include "rump_vfs_private.h"
#include "rump_dev_private.h"
-struct proc proc0;
+/* is this still necessary or use kern_proc stuff? */
struct session rump_session = {
.s_count = 1,
.s_flags = 0,
@@ -97,10 +97,7 @@
.pg_session = &rump_session,
.pg_jobc = 1,
};
-struct pstats rump_stats;
-struct plimit rump_limits;
-struct filedesc rump_filedesc0;
-struct proclist allproc;
+
char machine[] = MACHINE;
static kauth_cred_t rump_susercred;
@@ -204,7 +201,6 @@
char buf[256];
struct timespec ts;
uint64_t sec, nsec;
- struct proc *p;
struct lwp *l;
int i, numcpu;
int error;
@@ -280,6 +276,7 @@
l = &lwp0;
l->l_lid = 1;
l->l_cpu = l->l_target_cpu = rump_cpu;
+ l->l_fd = &filedesc0;
rumpuser_set_curlwp(l);
mutex_init(&tty_lock, MUTEX_DEFAULT, IPL_NONE);
@@ -305,31 +302,14 @@
kauth_init();
rump_susercred = rump_cred_create(0, 0, 0, NULL);
- /* init proc0 and rest of lwp0 now that we can allocate memory */
- p = &proc0;
- p->p_stats = &rump_stats;
- p->p_limit = &rump_limits;
- p->p_pgrp = &rump_pgrp;
- p->p_pid = 0;
- p->p_fd = &rump_filedesc0;
- p->p_vmspace = &rump_vmspace;
- p->p_emul = &emul_netbsd;
- p->p_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
l->l_cred = rump_cred_suserget();
- l->l_proc = p;
- LIST_INIT(&allproc);
- LIST_INSERT_HEAD(&allproc, &proc0, p_list);
- proc_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
+ l->l_proc = &proc0;
+ procinit();
+ proc0_init();
lwpinit_specificdata();
lwp_initspecific(&lwp0);
- mutex_init(&rump_limits.pl_lock, MUTEX_DEFAULT, IPL_NONE);
- rump_limits.pl_rlimit[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
- rump_limits.pl_rlimit[RLIMIT_NOFILE].rlim_cur = RLIM_INFINITY;
- rump_limits.pl_rlimit[RLIMIT_SBSIZE].rlim_cur = RLIM_INFINITY;
- rump_limits.pl_corename = defcorename;
-
rump_scheduler_init();
/* revert temporary context and schedule a real context */
l->l_cpu = NULL;
@@ -401,8 +381,6 @@
sigemptyset(&sigcantmask);
- lwp0.l_fd = proc0.p_fd = fd_init(&rump_filedesc0);
-
if (rump_threads)
vmem_rehash_start();
@@ -536,15 +514,17 @@
p = kmem_zalloc(sizeof(*p), KM_SLEEP);
if (rump_proc_vfs_init)
rump_proc_vfs_init(p);
- p->p_stats = &rump_stats;
- p->p_limit = lim_copy(&rump_limits);
+ p->p_stats = proc0.p_stats; /* XXX */
+ p->p_limit = lim_copy(proc0.p_limit);
p->p_pid = pid;
- p->p_vmspace = &rump_vmspace;
+ p->p_vmspace = &vmspace0;
p->p_emul = &emul_netbsd;
p->p_fd = fd_init(NULL);
p->p_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
p->p_pgrp = &rump_pgrp;
l->l_cred = rump_cred_suserget();
+
+ atomic_inc_uint(&nprocs);
} else {
p = &proc0;
l->l_cred = rump_susercred;
@@ -591,6 +571,8 @@
rump_cred_put(l->l_cred);
limfree(p->p_limit);
kmem_free(p, sizeof(*p));
+
+ atomic_dec_uint(&nprocs);
}
KASSERT((l->l_flag & LW_WEXIT) == 0);
l->l_flag |= LW_WEXIT;
diff -r 550c64443253 -r afa1208263ee sys/rump/librump/rumpkern/rump_private.h
--- a/sys/rump/librump/rumpkern/rump_private.h Thu Jun 10 20:54:53 2010 +0000
+++ b/sys/rump/librump/rumpkern/rump_private.h Thu Jun 10 21:40:42 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_private.h,v 1.50 2010/06/03 10:56:20 pooka Exp $ */
+/* $NetBSD: rump_private.h,v 1.51 2010/06/10 21:40:42 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -48,17 +48,18 @@
#include "rumpkern_if_priv.h"
Home |
Main Index |
Thread Index |
Old Index