From ca72f5d6c0d515036748cef287cc0d3a277536ea Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 6 Jul 2018 08:04:00 -0400 Subject: driver: struct slbt_fd_ctx: added .fdcwd and .fddst. --- include/slibtool/slibtool.h | 2 ++ src/driver/slbt_driver_ctx.c | 12 ++++++++++-- src/internal/slibtool_driver_impl.h | 14 ++++++++++++++ 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; -- cgit v1.2.3