mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-03-23 18:47:22 +08:00
[smart] fixup of script execution (#9009)
This patch fixup the script execution capabilities on argv passing
and adds support for arguments larger than 4k.
According to POSIX, the script parameter is quiet different
from the current implementation. Especially on the way it inserts
the path of executables. At the end, when you execute a script
from `$PATH`, it always fails.
For the script, interpreter will be invoked with the following
arguments: `{interpreter [optional-arg] pathname arg...}`
where pathname is the pathname of the file specified as the first
argument of execve(), and arg... is the series of words pointed
to by the argv argument of execve(), starting at argv[1]. Note that
there is no way to get the argv[0] that was passed to the
execve() call.
The changes include:
- Separating argument, environment variable, and auxiliary vector
processing into a new lwp_args.c file.
- Fixing bugs in script argument processing and supporting arguments
larger than 4k.
- Updating lwp_execve to use the new argscopy function and removing
the old lwp_argscopy function.
- Making various modifications to lwp_load and elf_aux_fill to work
with the new argument processing.
- Removing unnecessary code related to dynamic loading and interpreter
scripts.
Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
@@ -151,9 +151,6 @@ void lwp_unmap_user_space(struct rt_lwp *lwp);
|
||||
int lwp_unmap_user(struct rt_lwp *lwp, void *va);
|
||||
void *lwp_map_user(struct rt_lwp *lwp, void *map_va, size_t map_size, rt_bool_t text);
|
||||
|
||||
void lwp_free_command_line_args(char** argv);
|
||||
char** lwp_get_command_line_args(struct rt_lwp *lwp);
|
||||
|
||||
rt_varea_t lwp_map_user_varea(struct rt_lwp *lwp, void *map_va, size_t map_size);
|
||||
|
||||
/* check LWP_MAP_FLAG_* */
|
||||
|
||||
Reference in New Issue
Block a user