From a85d3ea1cc6fc5f9e011a1b29e93c776da108a0b Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 21 Jul 2018 20:32:45 -0400 Subject: driver, library interfaces: support alternate fd's for input/output/error/log. --- src/internal/perk_driver_impl.h | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'src/internal') diff --git a/src/internal/perk_driver_impl.h b/src/internal/perk_driver_impl.h index 4a4d231..b17b7be 100644 --- a/src/internal/perk_driver_impl.h +++ b/src/internal/perk_driver_impl.h @@ -32,6 +32,7 @@ enum app_tags { struct pe_driver_ctx_impl { struct pe_common_ctx cctx; struct pe_driver_ctx ctx; + struct pe_fd_ctx fdctx; const struct pe_unit_ctx * euctx; const char * eunit; struct pe_error_info ** errinfp; @@ -73,4 +74,46 @@ static inline void pe_driver_set_ectx( ictx->eunit = unit; } +static inline int pe_driver_fdin(const struct pe_driver_ctx * dctx) +{ + struct pe_fd_ctx fdctx; + pe_get_driver_fdctx(dctx,&fdctx); + return fdctx.fdin; +} + +static inline int pe_driver_fdout(const struct pe_driver_ctx * dctx) +{ + struct pe_fd_ctx fdctx; + pe_get_driver_fdctx(dctx,&fdctx); + return fdctx.fdout; +} + +static inline int pe_driver_fderr(const struct pe_driver_ctx * dctx) +{ + struct pe_fd_ctx fdctx; + pe_get_driver_fdctx(dctx,&fdctx); + return fdctx.fderr; +} + +static inline int pe_driver_fdlog(const struct pe_driver_ctx * dctx) +{ + struct pe_fd_ctx fdctx; + pe_get_driver_fdctx(dctx,&fdctx); + return fdctx.fdlog; +} + +static inline int pe_driver_fdcwd(const struct pe_driver_ctx * dctx) +{ + struct pe_fd_ctx fdctx; + pe_get_driver_fdctx(dctx,&fdctx); + return fdctx.fdcwd; +} + +static inline int pe_driver_fddst(const struct pe_driver_ctx * dctx) +{ + struct pe_fd_ctx fdctx; + pe_get_driver_fdctx(dctx,&fdctx); + return fdctx.fddst; +} + #endif -- cgit v1.2.3