]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add helper functions to copy strings into struct image_args.
authorbrooks <brooks@FreeBSD.org>
Thu, 29 Nov 2018 21:00:56 +0000 (21:00 +0000)
committerbrooks <brooks@FreeBSD.org>
Thu, 29 Nov 2018 21:00:56 +0000 (21:00 +0000)
commit54c8f3c8e75f259594c8e1f3ee85f3ec7de2a1d8
tree48d4d749d3e70f2736330d671e4b721ff5c3debd
parent8d1fd0fff1b73d770857ca2cb3ed3cb0de10a604
Add helper functions to copy strings into struct image_args.

Given a zeroed struct image_args with an allocated buf member,
exec_args_add_fname() must be called to install a file name (or NULL).
Then zero or more calls to exec_args_add_env() followed by zero or
more calls to exec_args_add_env(). exec_args_adjust_args() may be
called after args and/or env to allow an interpreter to be prepended to
the argument list.

To allow code reuse when adding arg and env variables, begin_envv
should be accessed with the accessor exec_args_get_begin_envv()
which handles the case when no environment entries have been added.

Use these functions to simplify exec_copyin_args() and
freebsd32_exec_copyin_args().

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15468
sys/compat/cloudabi32/cloudabi32_module.c
sys/compat/cloudabi64/cloudabi64_module.c
sys/compat/freebsd32/freebsd32_misc.c
sys/kern/imgact_binmisc.c
sys/kern/imgact_shell.c
sys/kern/kern_exec.c
sys/sys/imgact.h