From f6e94a01fd84b693c5a74b8f40edb4dc89836bdf Mon Sep 17 00:00:00 2001 From: David Timber Date: Fri, 6 Aug 2021 15:59:38 +1000 Subject: htbt and protocol overhaul ... * htbt overhaul * Abandon async slv io. slv io is now synchronous * htbt_do_cmd() * w/ detach flag: set up closed pipes for stdio * Create new pg for child and kill the pg on error * Do waitpid() w/ timeout * Wait for child spawn w/ timeout * Always reap child * Add fork cb for clean up code(to unmask signals, deinit libs) * Protocol overhaul * Use stdio frames to transfer binary data for PRNE_HTBT_OP_UP_BIN and PRNE_HTBT_OP_RUN_BIN op * bin_meta bin_size -> alloc_len. This is an optional field now * Fix protocol * detach flag of cmd_head not being (de)serialised * cmd_head (d)ser funcs not setting actual correctly * Proone: call setsid() on daemonisation * Fix compilation error caused by missing --- src/protocol.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/protocol.h') diff --git a/src/protocol.h b/src/protocol.h index e5003d7..8e33736 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -143,24 +143,22 @@ typedef enum { * TODO * * Followed by: - * uint24_t bin_len + * uint24_t alloc_len * uint5_t rsv * uint1_t detach * uint10_t args_len * char args[args_len] - * uint8_t bin[bin_len] */ PRNE_HTBT_OP_UP_BIN, /* Run Binary Operation * TODO * * Followed by: - * uint24_t bin_len + * uint24_t alloc_len * uint5_t rsv * uint1_t detach * uint10_t args_len * char args[args_len] - * uint8_t bin[bin_len] */ PRNE_HTBT_OP_RUN_BIN, /* STDIO Frame @@ -197,7 +195,6 @@ typedef enum { */ PRNE_HTBT_STATUS_ERRNO, PRNE_HTBT_STATUS_SUB, - PRNE_HTBT_STATUS_TIMEDOUT, PRNE_HTBT_STATUS_LIMIT, NB_PRNE_HTBT_STATUS @@ -249,7 +246,7 @@ struct prne_htbt_cmd { }; struct prne_htbt_bin_meta { - uint32_t bin_size; + uint32_t alloc_len; prne_htbt_cmd_t cmd; }; @@ -298,7 +295,7 @@ typedef prne_htbt_ser_rc_t(*prne_htbt_dser_ft)( #define PRNE_HTBT_ARGS_MAX 255 #define PRNE_HTBT_ARG_MEM_MAX 1023 #define PRNE_HTBT_STDIO_LEN_MAX 0x0FFF -#define PRNE_HTBT_BIN_LEN_MAX 0xFFFFFF +#define PRNE_HTBT_BIN_ALLOC_LEN_MAX 0xFFFFFF /* PRNE_HTBT_PROTO_MIN_BUF * -- cgit