summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2022-09-26 14:43:49 +0000
committermidipix <writeonce@midipix.org>2022-09-26 14:46:59 +0000
commit8ec5cef55b0a328992210b42f1186a1402b21169 (patch)
treefbe34803ffe44e085aed1988ea7da1657c370455 /src/driver
parent2a8fd516dd14e7676e5a2a57a6db10bf1407988f (diff)
downloadntux-8ec5cef55b0a328992210b42f1186a1402b21169.tar.bz2
ntux-8ec5cef55b0a328992210b42f1186a1402b21169.tar.xz
ntux_cmd_fspath(): initial implementation and driver integration.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/ntux_amain.c3
-rw-r--r--src/driver/ntux_driver_ctx.c48
2 files changed, 51 insertions, 0 deletions
diff --git a/src/driver/ntux_amain.c b/src/driver/ntux_amain.c
index dbf5039..d103046 100644
--- a/src/driver/ntux_amain.c
+++ b/src/driver/ntux_amain.c
@@ -63,6 +63,9 @@ static void ntux_perform_unit_actions(
else if (dctx->cctx->cmd == NTUX_CMD_ACEIT)
ntux_cmd_aceit(dctx,unit);
+
+ else if (dctx->cctx->cmd == NTUX_CMD_FSPATH)
+ ntux_cmd_fspath(dctx,unit);
}
static int ntux_exit(struct ntux_driver_ctx * dctx, int ret)
diff --git a/src/driver/ntux_driver_ctx.c b/src/driver/ntux_driver_ctx.c
index 3edf1d2..129992c 100644
--- a/src/driver/ntux_driver_ctx.c
+++ b/src/driver/ntux_driver_ctx.c
@@ -35,6 +35,7 @@ static const char * const ntux_cmd_name[NTUX_CMD_CAP] = {
[NTUX_CMD_STRACE] = "strace",
[NTUX_CMD_CHMOD] = "chmod",
[NTUX_CMD_ACEIT] = "aceit",
+ [NTUX_CMD_FSPATH] = "fspath",
};
/* ntux command options */
@@ -45,6 +46,7 @@ static const struct argv_option * ntux_cmd_options[NTUX_CMD_CAP] = {
[NTUX_CMD_STRACE] = ntux_strace_options,
[NTUX_CMD_CHMOD] = ntux_chmod_options,
[NTUX_CMD_ACEIT] = ntux_aceit_options,
+ [NTUX_CMD_FSPATH] = ntux_fspath_options,
};
/* package info */
@@ -211,6 +213,9 @@ static int ntux_cctx_update(
else if (!strcmp(entry->arg,"aceit"))
cctx->cmd = NTUX_CMD_ACEIT;
+ else if (!strcmp(entry->arg,"fspath"))
+ cctx->cmd = NTUX_CMD_FSPATH;
+
break;
case TAG_LOADER:
@@ -258,6 +263,44 @@ static int ntux_cctx_update(
case TAG_DUMP:
cctx->drvflags |= NTUX_DRIVER_DUMP;
break;
+
+ case TAG_SYNTAX:
+ case TAG_RPATH:
+ case TAG_APATH:
+ case TAG_NPATH:
+ case TAG_DPATH:
+ cctx->drvflags &= ~(uint64_t)NTUX_DRIVER_RPATH;
+ cctx->drvflags &= ~(uint64_t)NTUX_DRIVER_APATH;
+ cctx->drvflags &= ~(uint64_t)NTUX_DRIVER_NPATH;
+ cctx->drvflags &= ~(uint64_t)NTUX_DRIVER_DPATH;
+
+ if (entry->tag == TAG_SYNTAX) {
+ if (!strcmp(entry->arg,"relative"))
+ cctx->drvflags |= NTUX_DRIVER_RPATH;
+
+ else if (!strcmp(entry->arg,"absolute"))
+ cctx->drvflags |= NTUX_DRIVER_APATH;
+
+ else if (!strcmp(entry->arg,"native"))
+ cctx->drvflags |= NTUX_DRIVER_NPATH;
+
+ else if (!strcmp(entry->arg,"driver"))
+ cctx->drvflags |= NTUX_DRIVER_DPATH;
+
+ } else if (entry->tag == TAG_RPATH) {
+ cctx->drvflags |= NTUX_DRIVER_RPATH;
+
+ } else if (entry->tag == TAG_APATH) {
+ cctx->drvflags |= NTUX_DRIVER_APATH;
+
+ } else if (entry->tag == TAG_NPATH) {
+ cctx->drvflags |= NTUX_DRIVER_NPATH;
+
+ } else if (entry->tag == TAG_DPATH) {
+ cctx->drvflags |= NTUX_DRIVER_DPATH;
+ }
+
+ break;
}
} else {
(*nunits)++;
@@ -299,6 +342,8 @@ static int ntux_cmd_from_program(const char * program)
return NTUX_CMD_CHMOD;
else if (!strcmp(mark,"aceit"))
return NTUX_CMD_ACEIT;
+ else if (!strcmp(mark,"fspath"))
+ return NTUX_CMD_FSPATH;
return NTUX_CMD_DEFAULT;
}
@@ -440,6 +485,9 @@ int ntux_get_driver_ctx(
else if (cctx.cmd == NTUX_CMD_ACEIT)
argv_optv_init(ntux_aceit_options,optv);
+ else if (cctx.cmd == NTUX_CMD_FSPATH)
+ argv_optv_init(ntux_fspath_options,optv);
+
/* spawn, strace */
if ((cctx.cmd == NTUX_CMD_SPAWN) || (cctx.cmd == NTUX_CMD_STRACE)) {
argv_scan(argv,optv,&ctx,0);