From a82cc2f34bddae9b79e582a3bcc6b2c9cbb5009b Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 27 Jun 2018 03:51:35 +0000 Subject: driver, library interfaces: support alternate fd's for input/output/error/log. --- include/slibtool/slibtool.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h index c34bf99..54b3e4d 100644 --- a/include/slibtool/slibtool.h +++ b/include/slibtool/slibtool.h @@ -122,6 +122,13 @@ struct slbt_source_version { const char * commit; }; +struct slbt_fd_ctx { + int fdin; + int fdout; + int fderr; + int fdlog; +}; + struct slbt_exec_ctx { char * program; char * compiler; @@ -247,10 +254,15 @@ struct slbt_driver_ctx { slbt_api const struct slbt_source_version * slbt_source_version(void); /* driver api */ -slbt_api int slbt_get_driver_ctx (char ** argv, char ** envp, uint32_t flags, struct slbt_driver_ctx **); -slbt_api int slbt_create_driver_ctx (const struct slbt_common_ctx *, struct slbt_driver_ctx **); +slbt_api int slbt_get_driver_ctx (char ** argv, char ** envp, uint32_t flags, + const struct slbt_fd_ctx *, struct slbt_driver_ctx **); +slbt_api int slbt_create_driver_ctx (const struct slbt_common_ctx *, + const struct slbt_fd_ctx *, struct slbt_driver_ctx **); slbt_api void slbt_free_driver_ctx (struct slbt_driver_ctx *); +slbt_api int slbt_get_driver_fdctx (const struct slbt_driver_ctx *, struct slbt_fd_ctx *); +slbt_api int slbt_set_driver_fdctx (struct slbt_driver_ctx *, const struct slbt_fd_ctx *); + /* execution context api */ slbt_api int slbt_get_exec_ctx (const struct slbt_driver_ctx *, struct slbt_exec_ctx **); slbt_api void slbt_free_exec_ctx (struct slbt_exec_ctx *); @@ -276,7 +288,8 @@ slbt_api int slbt_copy_file (const struct slbt_driver_ctx *, struct slbt_exec_ slbt_api int slbt_dump_machine (const char * compiler, char * machine, size_t bufsize); /* utility api */ -slbt_api int slbt_main (int, char **, char **); +slbt_api int slbt_main (int, char **, char **, + const struct slbt_fd_ctx *); slbt_api int slbt_output_config (const struct slbt_driver_ctx *); slbt_api int slbt_output_features (const struct slbt_driver_ctx *); slbt_api int slbt_output_exec (const struct slbt_driver_ctx *, const struct slbt_exec_ctx *, const char *); -- cgit v1.2.3