Add execve / fexecve support to ZIpOS (#727)

This commit is contained in:
Gavin Hayes 2023-02-24 14:48:24 -05:00 committed by GitHub
parent 0312898979
commit 5923d483a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 143 additions and 22 deletions

View file

@ -17,6 +17,8 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/itoa.h"
#include "libc/runtime/runtime.h"
@ -58,3 +60,27 @@ TEST(execve, testArgPassing) {
EXITS(0);
}
}
TEST(execve, ziposELF) {
if (!IsLinux() && !IsFreebsd()) {
EXPECT_SYS(ENOSYS, -1,
execve("/zip/life.elf", (char *const[]){0}, (char *const[]){0}));
return;
}
SPAWN(fork);
execve("/zip/life.elf", (char *const[]){0}, (char *const[]){0});
notpossible;
EXITS(42);
}
TEST(execve, ziposAPE) {
if (!IsLinux()) {
EXPECT_EQ(-1, execve("/zip/life-nomod.com", (char *const[]){0},
(char *const[]){0}));
return;
}
SPAWN(fork);
execve("/zip/life-nomod.com", (char *const[]){0}, (char *const[]){0});
notpossible;
EXITS(42);
}