The early environment is typically cleared, so these new options
need the PRESERVE_EARLY_KENV kernel config(8) option. These environments
are reported as missing by kenv(1) if the option is not present in the
running kernel.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Dump seems overloaded here. It was confusing before and this compounds the confusion.
bin/kenv/kenv.1 | ||
---|---|---|
54 | Dump is a terrible word. Does this mean discard or list? I'd suggest replacing the ambiguous term with whichever this is. |
sys/kern/kern_environment.c | ||
---|---|---|
182 | I think it might be a bit clearer to rewrite this as a switch on the what. I think it's then more obvious that your MPASS is really an '_assert_unreachable()'. Looking at this even further though, I think I'd really like to just split out this early section into a helper function: static int kenv_dump(char **envp, int what, char *value, int len) { char *senv; senv = **envp; .... } And then in sys_kenv() you add this to the start of the switch statement below: switch (uap->what) { case KENV_DUMP: return (kenv_dump(kenvp, uap->what, uap->value, uap->len)); case KENV_DUMP_LOADER: case KENV_DUMP_STATIC: #ifdef PRESERVE_EARLY_KENV return (kenv_dump(uap->what == KENV_DUMP_LOADER ? &md_envp : &kern_envp, uap->what, uap->value, uap->len); #else return (ENOENT); #endif ` |