Add the #vars device to export kernel variables
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 24 Nov 2015 13:29:44 +0000 (08:29 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 30 Nov 2015 21:06:38 +0000 (16:06 -0500)
commit72906d8649fa465f2c6e00dd9ab3fa2f057e4b85
treedee8d59bd2a248ad5ebe5fa06f054c6545d30072
parentf76a43e8050e5ffaa1eb9ba553f35b20086093b9
Add the #vars device to export kernel variables

With #vars, you can specify certain variables, such as num_cores, to be
exposed to userspace.  If you want, you can:

$ bind -a \#vars /dev
$ cat /dev/num_cores!dw

For debugging, you can add entries with the DEVVARS_ENTRY(name, format)
macro.  'format' is two chars, the data_format and the data_size, using
Qemu's notation.

Privileged users (i.e. anyone) can add new entries to #vars, which
internally will do a lookup in the symbol table and trust the format
string.  This is a little dangerous.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/dev/Kbuild
kern/drivers/dev/Kconfig
kern/drivers/dev/vars.c [new file with mode: 0644]
kern/include/ns.h