diff --git a/lib/librumpuser/rumpuser.c b/lib/librumpuser/rumpuser.c index 7c41fe4af14a..231c6b8837cd 100644 --- a/lib/librumpuser/rumpuser.c +++ b/lib/librumpuser/rumpuser.c @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.3 2010/04/21 11:16:41 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.4 2010/04/28 00:33:45 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: rumpuser.c,v 1.3 2010/04/21 11:16:41 pooka Exp $"); +__RCSID("$NetBSD: rumpuser.c,v 1.4 2010/04/28 00:33:45 pooka Exp $"); #endif /* !lint */ /* thank the maker for this */ @@ -46,6 +46,7 @@ __RCSID("$NetBSD: rumpuser.c,v 1.3 2010/04/21 11:16:41 pooka Exp $"); #ifdef __NetBSD__ #include +#include #endif #include @@ -589,3 +590,18 @@ rumpuser_kill(int64_t pid, int sig, int *error) return -1; #endif } + +int +rumpuser_getnhostcpu(void) +{ + int ncpu; + size_t sz = sizeof(ncpu); + +#ifdef __NetBSD__ + if (sysctlbyname("hw.ncpu", &ncpu, &sz, NULL, 0) == -1) + return 1; + return ncpu; +#else + return 1; +#endif +} diff --git a/sys/rump/include/rump/rumpuser.h b/sys/rump/include/rump/rumpuser.h index 1ae2006e9192..a0d3f3a0858c 100644 --- a/sys/rump/include/rump/rumpuser.h +++ b/sys/rump/include/rump/rumpuser.h @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.39 2010/04/21 11:13:29 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.40 2010/04/28 00:33:45 pooka Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -109,6 +109,8 @@ int rumpuser_writewatchfile_wait(int, intptr_t *, int *); int rumpuser_dprintf(const char *, ...); +int rumpuser_getnhostcpu(void); + /* rumpuser_pth */ void rumpuser_thrinit(kernel_lockfn, kernel_unlockfn, int); void rumpuser_biothread(void *);