summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/ptycon/ptycon.h2
-rw-r--r--src/driver/ptyc_driver_ctx.c12
-rw-r--r--src/internal/ptycon_driver_impl.h1
-rw-r--r--src/skin/ptyc_skin_default.c4
4 files changed, 19 insertions, 0 deletions
diff --git a/include/ptycon/ptycon.h b/include/ptycon/ptycon.h
index 78282cf..0add151 100644
--- a/include/ptycon/ptycon.h
+++ b/include/ptycon/ptycon.h
@@ -60,6 +60,8 @@ struct ptyc_common_ctx {
uint64_t fmtflags;
nt_pty * hpts;
nt_pty * hptm;
+ void * hroot;
+ const char * sysroot;
char ** catv;
char ** eargv;
};
diff --git a/src/driver/ptyc_driver_ctx.c b/src/driver/ptyc_driver_ctx.c
index 459abe2..dfaa572 100644
--- a/src/driver/ptyc_driver_ctx.c
+++ b/src/driver/ptyc_driver_ctx.c
@@ -292,6 +292,10 @@ int ptyc_get_driver_ctx(
nunits++;
break;
+ case TAG_SYSROOT:
+ cctx.sysroot = entry->arg;
+ break;
+
case TAG_WAIT:
cctx.drvflags |= PTYC_DRIVER_DBG_WAIT;
break;
@@ -301,6 +305,14 @@ int ptyc_get_driver_ctx(
return ptyc_driver_usage(program,0,options,meta);
}
+ if (cctx.sysroot && ptyc_open_dir(&cctx.hroot,0,cctx.sysroot,false)) {
+ if (flags & PTYC_DRIVER_VERBOSITY_ERRORS)
+ fprintf(stderr,
+ "%s: error: could not open sysroot directory '%s'",
+ program,cctx.sysroot);
+ return ptyc_get_driver_ctx_fail(meta);
+ }
+
if (!(ctx = ptyc_driver_ctx_alloc(meta,&cctx,nunits)))
return ptyc_get_driver_ctx_fail(meta);
diff --git a/src/internal/ptycon_driver_impl.h b/src/internal/ptycon_driver_impl.h
index 67393ff..ee2e5ca 100644
--- a/src/internal/ptycon_driver_impl.h
+++ b/src/internal/ptycon_driver_impl.h
@@ -26,6 +26,7 @@ enum app_tags {
TAG_VERSION,
TAG_DAEMON,
TAG_DEBUG,
+ TAG_SYSROOT,
TAG_CAT,
TAG_EXEC,
TAG_WAIT,
diff --git a/src/skin/ptyc_skin_default.c b/src/skin/ptyc_skin_default.c
index 814f6c2..b558fff 100644
--- a/src/skin/ptyc_skin_default.c
+++ b/src/skin/ptyc_skin_default.c
@@ -17,6 +17,10 @@ const struct argv_option ptyc_default_options[] = {
ARGV_OPTION_HYBRID_ONLY | ARGV_OPTION_HYBRID_SPACE,
0,0,"synonym for --exec."},
+ {"sysroot", 0,TAG_SYSROOT,ARGV_OPTARG_REQUIRED,0,0,"<dir>",
+ "pass a handle to %s to the spawned child process, "
+ "and set it to be the child's intial root directory."},
+
{"daemon", 0,TAG_DAEMON,ARGV_OPTARG_OPTIONAL,0,"default|always|never",0,
"create a daemon thread and handle signals sent by the "
"application's own controlling terminal. The default is "