summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/mach-sandbox
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2020-09-14 15:37:47 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-09-15 14:24:28 +0200
commit242d9e7531fbc394214d2a54d3ff56a5690f397a (patch)
tree07ebc3ab16aa0525a29f9cbabfc29d79f88c4f7b /arch/sandbox/mach-sandbox
parent65ca0db25b6aca3df1ff0adf1a9469e83983614f (diff)
downloadbarebox-242d9e7531fbc394214d2a54d3ff56a5690f397a.tar.gz
barebox-242d9e7531fbc394214d2a54d3ff56a5690f397a.tar.xz
sandbox: implement actual sandbox reset via exec(2)
On Linux, /proc/self/exe is a symlink to the originally exec(2)d executable. We can exec that with the original argv to simulate a reset. This is useful for shorter development cycles on sandbox and in future, could be used to test barebox behavior around resets (e.g. reset reason can be passed through via libc environment). We leave the original hanging reset in place though, because: - Many boards have multiple reset providers and incoming patches will allow users to select a specific one. Having this on sandbox as well makes testing easier. - /proc/self/exe is Linux-specific and wouldn't work when being run on e.g. BSDs or macOS Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/mach-sandbox')
-rw-r--r--arch/sandbox/mach-sandbox/include/mach/linux.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h
index f0a3a7b510..1ab48e52a0 100644
--- a/arch/sandbox/mach-sandbox/include/mach/linux.h
+++ b/arch/sandbox/mach-sandbox/include/mach/linux.h
@@ -18,6 +18,7 @@ off_t linux_lseek(int fildes, off_t offset);
int linux_tstc(int fd);
void __attribute__((noreturn)) linux_exit(void);
void linux_hang(void);
+void linux_reexec(void);
int linux_execve(const char * filename, char *const argv[], char *const envp[]);