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 Include sys_select.c for proper se...



details:   https://anonhg.NetBSD.org/src/rev/7c2d7fcf0923
branches:  trunk
changeset: 748196:7c2d7fcf0923
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Oct 16 00:14:53 2009 +0000

description:
Include sys_select.c for proper select()/poll() support.

diffstat:

 sys/rump/librump/rumpkern/Makefile.rumpkern |   4 +-
 sys/rump/librump/rumpkern/emul.c            |  66 +-------------------
 sys/rump/librump/rumpkern/locks.c           |   8 +-
 sys/rump/librump/rumpkern/rump.c            |  17 +++--
 sys/rump/librump/rumpkern/rump_private.h    |  12 +-
 sys/rump/librump/rumpkern/scheduler.c       |  25 ++++---
 sys/rump/librump/rumpkern/sleepq.c          |  92 ++++++++++++++++++++++------
 sys/rump/librump/rumpkern/vm.c              |  11 ++-
 8 files changed, 117 insertions(+), 118 deletions(-)

diffs (truncated from 541 to 300 lines):

diff -r cc9ec5823f10 -r 7c2d7fcf0923 sys/rump/librump/rumpkern/Makefile.rumpkern
--- a/sys/rump/librump/rumpkern/Makefile.rumpkern       Thu Oct 15 23:42:40 2009 +0000
+++ b/sys/rump/librump/rumpkern/Makefile.rumpkern       Fri Oct 16 00:14:53 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.rumpkern,v 1.52 2009/10/15 00:28:46 pooka Exp $
+#      $NetBSD: Makefile.rumpkern,v 1.53 2009/10/16 00:14:53 pooka Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -34,7 +34,7 @@
 SRCS+= init_sysctl_base.c kern_auth.c kern_descrip.c kern_event.c      \
        kern_ksyms.c kern_malloc_stdtype.c kern_module.c kern_rate.c    \
        kern_stub.c kern_sysctl.c kern_timeout.c kern_uidinfo.c param.c \
-       sys_descrip.c sys_generic.c syscalls.c
+       sys_descrip.c sys_generic.c sys_select.c syscalls.c
 
 # sys/kern subr (misc)
 SRCS+= subr_devsw.c subr_callback.c subr_evcnt.c subr_extent.c         \
diff -r cc9ec5823f10 -r 7c2d7fcf0923 sys/rump/librump/rumpkern/emul.c
--- a/sys/rump/librump/rumpkern/emul.c  Thu Oct 15 23:42:40 2009 +0000
+++ b/sys/rump/librump/rumpkern/emul.c  Fri Oct 16 00:14:53 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emul.c,v 1.102 2009/10/15 16:39:22 pooka Exp $ */
+/*     $NetBSD: emul.c,v 1.103 2009/10/16 00:14:53 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.102 2009/10/15 16:39:22 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.103 2009/10/16 00:14:53 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -93,7 +93,6 @@
 const char *domainname;
 int domainnamelen;
 
-const struct filterops seltrue_filtops;
 const struct filterops sig_filtops;
 
 #define DEVSW_SIZE 255
@@ -487,7 +486,7 @@
        case SIGSYS:
                break;
        default:
-               panic("unhandled signal %d", signo);
+               panic("unhandled signal %d\n", signo);
        }
 }
 
@@ -577,32 +576,6 @@
        return t;
 }
 
-int
-seltrue(dev_t dev, int events, struct lwp *l)
-{
-        return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
-}
-
-void
-selrecord(lwp_t *selector, struct selinfo *sip)
-{
-}
-
-void
-selinit(struct selinfo *sip)
-{
-}
-
-void
-selnotify(struct selinfo *sip, int events, long knhint)
-{
-}
-
-void
-seldestroy(struct selinfo *sip)
-{
-}
-
 const char *
 device_xname(device_t dv)
 {
@@ -741,39 +714,6 @@
        rumpuser_exit(0);
 }
 
-/*
- * XXX: from sys_select.c, see that file for license.
- * (these will go away really soon in favour of the real sys_select.c)
- * ((really, the select code just needs cleanup))
- * (((seriously)))
- */
-int
-inittimeleft(struct timespec *ts, struct timespec *sleepts)
-{
-       if (itimespecfix(ts))
-               return -1;
-       getnanouptime(sleepts);
-       return 0;
-}
-
-int
-gettimeleft(struct timespec *ts, struct timespec *sleepts)
-{
-       /*
-        * We have to recalculate the timeout on every retry.
-        */
-       struct timespec sleptts;
-       /*
-        * reduce ts by elapsed time
-        * based on monotonic time scale
-        */
-       getnanouptime(&sleptts);
-       timespecadd(ts, sleepts, ts);
-       timespecsub(ts, &sleptts, ts);
-       *sleepts = sleptts;
-       return tstohz(ts);
-}
-
 bool
 pmf_device_register1(struct device *dev,
        bool (*suspend)(device_t PMF_FN_PROTO),
diff -r cc9ec5823f10 -r 7c2d7fcf0923 sys/rump/librump/rumpkern/locks.c
--- a/sys/rump/librump/rumpkern/locks.c Thu Oct 15 23:42:40 2009 +0000
+++ b/sys/rump/librump/rumpkern/locks.c Fri Oct 16 00:14:53 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locks.c,v 1.31 2009/10/15 23:15:55 pooka Exp $ */
+/*     $NetBSD: locks.c,v 1.32 2009/10/16 00:14:53 pooka Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.31 2009/10/15 23:15:55 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.32 2009/10/16 00:14:53 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -347,7 +347,7 @@
 
                        rump_unschedule_cpu(l);
                        rumpuser_mutex_enter_nowrap(rump_giantlock);
-                       l->l_cpu = rump_schedule_cpu();
+                       rump_schedule_cpu(l);
                }
                lockcnt++;
        }
@@ -391,7 +391,7 @@
 rump_user_schedule(int nlocks)
 {
 
-       curlwp->l_cpu = rump_schedule_cpu();
+       rump_schedule_cpu(curlwp);
 
        if (nlocks)
                _kernel_lock(nlocks);
diff -r cc9ec5823f10 -r 7c2d7fcf0923 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Thu Oct 15 23:42:40 2009 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Fri Oct 16 00:14:53 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.125 2009/10/15 16:39:22 pooka Exp $ */
+/*     $NetBSD: rump.c,v 1.126 2009/10/16 00:14:53 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.125 2009/10/15 16:39:22 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.126 2009/10/16 00:14:53 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -115,8 +115,8 @@
 static int rump_inited;
 static struct emul emul_rump;
 
-void rump__unavailable(void);
-void rump__unavailable() {}
+int rump__unavailable(void);
+int rump__unavailable() {return EOPNOTSUPP;}
 __weak_alias(rump_net_init,rump__unavailable);
 __weak_alias(rump_vfs_init,rump__unavailable);
 __weak_alias(rump_dev_init,rump__unavailable);
@@ -124,6 +124,7 @@
 __weak_alias(rump_vfs_fini,rump__unavailable);
 
 __weak_alias(biodone,rump__unavailable);
+__weak_alias(sopoll,rump__unavailable);
 
 void rump__unavailable_vfs_panic(void);
 void rump__unavailable_vfs_panic() {panic("vfs component not available");}
@@ -254,6 +255,7 @@
 
        callout_startup();
        callout_init_cpu(rump_cpu);
+       selsysinit(rump_cpu);
 
        sysctl_init();
        kqueue_init();
@@ -440,7 +442,6 @@
        l->l_proc = p;
        l->l_lid = lid;
        l->l_fd = p->p_fd;
-       l->l_mutex = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
        l->l_cpu = NULL;
 
        return l;
@@ -453,6 +454,9 @@
 
        rumpuser_set_curlwp(NULL);
        newlwp->l_cpu = l->l_cpu;
+       newlwp->l_mutex = l->l_mutex;
+       l->l_mutex = NULL;
+       l->l_cpu = NULL;
        rumpuser_set_curlwp(newlwp);
        if (l->l_flag & LW_WEXIT)
                rump_lwp_free(l);
@@ -481,9 +485,8 @@
 {
 
        KASSERT(l->l_flag & LW_WEXIT);
-       KASSERT(l != rumpuser_get_curlwp());
+       KASSERT(l->l_mutex == NULL);
        rump_cred_put(l->l_cred);
-       mutex_obj_free(l->l_mutex);
        kmem_free(l, sizeof(*l));
 }
 
diff -r cc9ec5823f10 -r 7c2d7fcf0923 sys/rump/librump/rumpkern/rump_private.h
--- a/sys/rump/librump/rumpkern/rump_private.h  Thu Oct 15 23:42:40 2009 +0000
+++ b/sys/rump/librump/rumpkern/rump_private.h  Fri Oct 16 00:14:53 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_private.h,v 1.33 2009/10/15 23:15:55 pooka Exp $  */
+/*     $NetBSD: rump_private.h,v 1.34 2009/10/16 00:14:53 pooka Exp $  */
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -86,11 +86,11 @@
 int            rump_sysproxy_copyout(const void *, void *, size_t);
 int            rump_sysproxy_copyin(const void *, void *, size_t);
 
-void           rump_scheduler_init(void);
-void           rump_schedule(void);
-void           rump_unschedule(void);
-struct cpu_info *rump_schedule_cpu(void);
-void           rump_unschedule_cpu(struct lwp *);
+void   rump_scheduler_init(void);
+void   rump_schedule(void);
+void   rump_unschedule(void);
+void   rump_schedule_cpu(struct lwp *);
+void   rump_unschedule_cpu(struct lwp *);
 
 void   rump_user_schedule(int);
 void   rump_user_unschedule(int, int *);
diff -r cc9ec5823f10 -r 7c2d7fcf0923 sys/rump/librump/rumpkern/scheduler.c
--- a/sys/rump/librump/rumpkern/scheduler.c     Thu Oct 15 23:42:40 2009 +0000
+++ b/sys/rump/librump/rumpkern/scheduler.c     Fri Oct 16 00:14:53 2009 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: scheduler.c,v 1.3 2009/10/15 23:15:55 pooka Exp $     */
+/*      $NetBSD: scheduler.c,v 1.4 2009/10/16 00:14:53 pooka Exp $     */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.3 2009/10/15 23:15:55 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.4 2009/10/16 00:14:53 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -78,6 +78,8 @@
                rcpu = &rcpu_storage[i];
                ci = &rump_cpus[i];
                rump_cpu_bootstrap(ci);
+               ci->ci_schedstate.spc_mutex =
+                   mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
                rcpu->rcpu_ci = ci;
                SLIST_INSERT_HEAD(&cpu_freelist, rcpu, rcpu_entries);
        }
@@ -86,7 +88,6 @@
 void
 rump_schedule()
 {
-       struct cpu_info *ci;
        struct lwp *l;
 
        /*
@@ -104,8 +105,7 @@
                rumpuser_mutex_exit(schedmtx);
 



Home | Main Index | Thread Index | Old Index