From 9706faf3b18a3fe231bff70e6d8acd62aaae99df Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 29 Jun 2018 01:00:36 -0400 Subject: execution context: generated wrapper: replaced the stream with a pure fd. --- src/internal/slibtool_driver_impl.h | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/internal/slibtool_driver_impl.h') diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h index 47c854e..2eb7a14 100644 --- a/src/internal/slibtool_driver_impl.h +++ b/src/internal/slibtool_driver_impl.h @@ -99,6 +99,17 @@ struct slbt_driver_ctx_impl { struct slbt_error_info erribuf[64]; }; +struct slbt_exec_ctx_impl { + int argc; + char * args; + char * shadow; + char * dsoprefix; + size_t size; + struct slbt_exec_ctx ctx; + int fdwrapper; + char * vbuffer[]; +}; + static inline struct slbt_driver_ctx_impl * slbt_get_driver_ictx(const struct slbt_driver_ctx * dctx) { uintptr_t addr; @@ -139,4 +150,34 @@ static inline int slbt_driver_fdlog(const struct slbt_driver_ctx * dctx) return fdctx.fdlog; } +static inline struct slbt_exec_ctx_impl * slbt_get_exec_ictx(const struct slbt_exec_ctx * ectx) +{ + uintptr_t addr; + + addr = (uintptr_t)ectx - offsetof(struct slbt_exec_ctx_impl,ctx); + return (struct slbt_exec_ctx_impl *)addr; +} + +static inline int slbt_exec_get_fdwrapper(const struct slbt_exec_ctx * ectx) +{ + struct slbt_exec_ctx_impl * ictx; + ictx = slbt_get_exec_ictx(ectx); + return ictx->fdwrapper; +} + +static inline void slbt_exec_set_fdwrapper(const struct slbt_exec_ctx * ectx, int fd) +{ + struct slbt_exec_ctx_impl * ictx; + ictx = slbt_get_exec_ictx(ectx); + ictx->fdwrapper = fd; +} + +static inline void slbt_exec_close_fdwrapper(const struct slbt_exec_ctx * ectx) +{ + struct slbt_exec_ctx_impl * ictx; + ictx = slbt_get_exec_ictx(ectx); + close(ictx->fdwrapper); + ictx->fdwrapper = (-1); +} + #endif -- cgit v1.2.3