summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/ntux/ntux.h2
-rw-r--r--src/cmds/ntux_cmd_spawn.c5
-rw-r--r--src/cmds/ntux_cmd_strace.c5
-rw-r--r--src/driver/ntux_amain.c10
4 files changed, 17 insertions, 5 deletions
diff --git a/include/ntux/ntux.h b/include/ntux/ntux.h
index 936b101..9c0c373 100644
--- a/include/ntux/ntux.h
+++ b/include/ntux/ntux.h
@@ -98,7 +98,7 @@ struct ntux_common_ctx {
uint64_t actflags;
uint64_t fmtflags;
enum ntux_cmd cmd;
- uint32_t state;
+ int32_t status;
char ** sargv;
char ** senvp;
const char * loader;
diff --git a/src/cmds/ntux_cmd_spawn.c b/src/cmds/ntux_cmd_spawn.c
index f488e3e..c4486fc 100644
--- a/src/cmds/ntux_cmd_spawn.c
+++ b/src/cmds/ntux_cmd_spawn.c
@@ -45,8 +45,11 @@ int ntux_cmd_spawn(const struct ntux_driver_ctx * dctx)
__sys_exit(0);
/* parent */
+ struct ntux_driver_ctx_impl * ictx = ntux_get_driver_ictx(dctx);
+
__sys_wait4(
- pid,&status,
+ pid,
+ &ictx->cctx.status,
0,0);
return 0;
diff --git a/src/cmds/ntux_cmd_strace.c b/src/cmds/ntux_cmd_strace.c
index bdc1308..a91e1d5 100644
--- a/src/cmds/ntux_cmd_strace.c
+++ b/src/cmds/ntux_cmd_strace.c
@@ -132,8 +132,11 @@ int ntux_cmd_strace(const struct ntux_driver_ctx * dctx)
return NTUX_SYSTEM_ERROR(dctx);
/* wait */
+ struct ntux_driver_ctx_impl * ictx = ntux_get_driver_ictx(dctx);
+
__sys_wait4(
- pid,&status,
+ pid,
+ &ictx->cctx.status,
0,0);
return 0;
diff --git a/src/driver/ntux_amain.c b/src/driver/ntux_amain.c
index 5b6587e..ae4f8f8 100644
--- a/src/driver/ntux_amain.c
+++ b/src/driver/ntux_amain.c
@@ -12,6 +12,8 @@
#include "ntux_driver_impl.h"
#include "ntux_nolibc_impl.h"
+#include <psxxfi/xfi_exit.h>
+
#ifndef NTUX_DRIVER_FLAGS
#define NTUX_DRIVER_FLAGS NTUX_DRIVER_VERBOSITY_ERRORS \
| NTUX_DRIVER_VERBOSITY_USAGE
@@ -87,11 +89,15 @@ int ntux_main(char ** argv, char ** envp, const struct ntux_fd_ctx * fdctx)
if ((ntux_version(dctx,fdout)) < 0)
return ntux_exit(dctx,NTUX_ERROR);
- if (dctx->cctx->cmd == NTUX_CMD_SPAWN)
+ if (dctx->cctx->cmd == NTUX_CMD_SPAWN) {
ntux_cmd_spawn(dctx);
+ __xfi_exit(dctx->cctx->status);
+ }
- if (dctx->cctx->cmd == NTUX_CMD_STRACE)
+ if (dctx->cctx->cmd == NTUX_CMD_STRACE) {
ntux_cmd_strace(dctx);
+ __xfi_exit(dctx->cctx->status);
+ }
for (unit=dctx->units; *unit; unit++)
ntux_perform_unit_actions(dctx,*unit);