summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-07-06 08:04:00 -0400
committermidipix <writeonce@midipix.org>2018-07-06 08:04:00 -0400
commitca72f5d6c0d515036748cef287cc0d3a277536ea (patch)
tree28d84e21cba2c30539aa31a013f5f93ef9767601
parent47b7add270aceb7865908e1ce0b4b4f09be118fa (diff)
downloadslibtool-ca72f5d6c0d515036748cef287cc0d3a277536ea.tar.bz2
slibtool-ca72f5d6c0d515036748cef287cc0d3a277536ea.tar.xz
driver: struct slbt_fd_ctx: added .fdcwd and .fddst.
-rw-r--r--include/slibtool/slibtool.h2
-rw-r--r--src/driver/slbt_driver_ctx.c12
-rw-r--r--src/internal/slibtool_driver_impl.h14
3 files changed, 26 insertions, 2 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index cc795bb..3971645 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -128,6 +128,8 @@ struct slbt_fd_ctx {
int fdout;
int fderr;
int fdlog;
+ int fdcwd;
+ int fddst;
};
struct slbt_exec_ctx {
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index b82e147..5f5f609 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -932,7 +932,9 @@ int slbt_get_driver_ctx(
.fdin = STDIN_FILENO,
.fdout = STDOUT_FILENO,
.fderr = STDERR_FILENO,
- .fdlog = (-1)
+ .fdlog = (-1),
+ .fdcwd = AT_FDCWD,
+ .fddst = AT_FDCWD,
};
}
@@ -1298,7 +1300,9 @@ int slbt_create_driver_ctx(
.fdin = STDIN_FILENO,
.fdout = STDOUT_FILENO,
.fderr = STDERR_FILENO,
- .fdlog = (-1)
+ .fdlog = (-1),
+ .fdcwd = AT_FDCWD,
+ .fddst = AT_FDCWD,
};
}
@@ -1419,6 +1423,8 @@ int slbt_get_driver_fdctx(
fdctx->fdout = ictx->fdctx.fdout;
fdctx->fderr = ictx->fdctx.fderr;
fdctx->fdlog = ictx->fdctx.fdlog;
+ fdctx->fdcwd = ictx->fdctx.fdcwd;
+ fdctx->fddst = ictx->fdctx.fddst;
return 0;
}
@@ -1435,6 +1441,8 @@ int slbt_set_driver_fdctx(
ictx->fdctx.fdout = fdctx->fdout;
ictx->fdctx.fderr = fdctx->fderr;
ictx->fdctx.fdlog = fdctx->fdlog;
+ ictx->fdctx.fdcwd = fdctx->fdcwd;
+ ictx->fdctx.fddst = fdctx->fddst;
return 0;
}
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index 2eb7a14..02345f8 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -150,6 +150,20 @@ static inline int slbt_driver_fdlog(const struct slbt_driver_ctx * dctx)
return fdctx.fdlog;
}
+static inline int slbt_driver_fdcwd(const struct slbt_driver_ctx * dctx)
+{
+ struct slbt_fd_ctx fdctx;
+ slbt_get_driver_fdctx(dctx,&fdctx);
+ return fdctx.fdcwd;
+}
+
+static inline int slbt_driver_fddst(const struct slbt_driver_ctx * dctx)
+{
+ struct slbt_fd_ctx fdctx;
+ slbt_get_driver_fdctx(dctx,&fdctx);
+ return fdctx.fddst;
+}
+
static inline struct slbt_exec_ctx_impl * slbt_get_exec_ictx(const struct slbt_exec_ctx * ectx)
{
uintptr_t addr;