Move kernel env global variables, etc to sys/kenv.h

The kernel globals for kenv are confined to 2 files that need them and
a few that likely shouldn't (but as written the code does). Move them
from sys/systm.h to sys/kenv.h. This removed a XXX from systm.h and
cleans it up a little bit...
This commit is contained in:
Warner Losh 2020-10-07 06:16:37 +00:00
parent 863f967f95
commit bc683a89a3
6 changed files with 19 additions and 14 deletions

View File

@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
#include "if_rtvar.h"
#include "if_rtreg.h"
#include <sys/kenv.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_arp.h>

View File

@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/cons.h>
#include <sys/kenv.h>
#include <sys/kernel.h>
#include <sys/linker.h>
#include <sys/module.h>

View File

@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/priv.h>
#include <sys/kenv.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/sysent.h>

View File

@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/lock.h>
#include <sys/kenv.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mutex.h>

View File

@ -42,4 +42,18 @@
#define KENV_MNAMELEN 128 /* Maximum name length (for the syscall) */
#define KENV_MVALLEN 128 /* Maximum value length (for the syscall) */
#ifdef _KERNEL
/*
* Most of these variables should be const.
*/
extern bool dynamic_kenv;
extern struct mtx kenv_lock;
extern char *kern_envp;
extern char *md_envp;
extern char static_env[];
extern char static_hints[]; /* by config for now */
extern char **kenvp;
#endif /* _KERNEL */
#endif /* !_SYS_KENV_H_ */

View File

@ -204,21 +204,7 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2);
})
#define SCHEDULER_STOPPED() SCHEDULER_STOPPED_TD(curthread)
/*
* XXX the hints declarations are even more misplaced than most declarations
* in this file, since they are needed in one file (per arch) and only used
* in two files.
* XXX most of these variables should be const.
*/
extern int osreldate;
extern bool dynamic_kenv;
extern struct mtx kenv_lock;
extern char *kern_envp;
extern char *md_envp;
extern char static_env[];
extern char static_hints[]; /* by config for now */
extern char **kenvp;
extern const void *zero_region; /* address space maps to a zeroed page */