Provide struct cpu_info *lwp_getcpu(struct lwp *) inline for <machine/cpu.h>
<machine/cpu.h> is include by <sys/lwp.h> before struct lwp is defined so it can't access members inside it. This provides an accessor which is defined after struct lwp is defined.
This commit is contained in:
parent
fb7a20f006
commit
3c142fea53
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: lwp.h,v 1.169 2014/05/16 10:05:38 rmind Exp $ */
|
/* $NetBSD: lwp.h,v 1.170 2015/03/31 01:10:02 matt Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
|
* Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
|
||||||
|
@ -49,6 +49,9 @@
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#if defined(_KERNEL)
|
#if defined(_KERNEL)
|
||||||
|
struct lwp;
|
||||||
|
/* forward declare this for <machine/cpu.h> so it can get l_cpu. */
|
||||||
|
static inline struct cpu_info *lwp_getcpu(struct lwp *);
|
||||||
#include <machine/cpu.h> /* curcpu() and cpu_info */
|
#include <machine/cpu.h> /* curcpu() and cpu_info */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -467,6 +470,16 @@ extern struct lwp *curlwp; /* Current running LWP */
|
||||||
#endif /* ! curlwp */
|
#endif /* ! curlwp */
|
||||||
#define curproc (curlwp->l_proc)
|
#define curproc (curlwp->l_proc)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This provide a way for <machine/cpu.h> to get l_cpu for curlwp before
|
||||||
|
* struct lwp is defined.
|
||||||
|
*/
|
||||||
|
static inline struct cpu_info *
|
||||||
|
lwp_getcpu(struct lwp *l)
|
||||||
|
{
|
||||||
|
return l->l_cpu;
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
CURCPU_IDLE_P(void)
|
CURCPU_IDLE_P(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue