Module Name: src Committed By: matt Date: Tue Mar 31 01:10:02 UTC 2015
Modified Files: src/sys/sys: lwp.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.169 -r1.170 src/sys/sys/lwp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/sys/lwp.h diff -u src/sys/sys/lwp.h:1.169 src/sys/sys/lwp.h:1.170 --- src/sys/sys/lwp.h:1.169 Fri May 16 10:05:38 2014 +++ src/sys/sys/lwp.h Tue Mar 31 01:10:02 2015 @@ -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 @@ -49,6 +49,9 @@ #include <sys/resource.h> #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 */ #endif @@ -467,6 +470,16 @@ extern struct lwp *curlwp; /* Current r #endif /* ! curlwp */ #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 CURCPU_IDLE_P(void) {