From 22ff642d242f580322286fd82d12d688333847ce Mon Sep 17 00:00:00 2001 From: KHANH LUONG HONG DUY Date: Tue, 4 Aug 2020 15:27:43 +0700 Subject: dlt_common: Execute system command using execvp Add function dlt_execute_command() to execute system command using execvp. Signed-off-by: KHANH LUONG HONG DUY --- include/dlt/dlt_common.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/dlt/dlt_common.h b/include/dlt/dlt_common.h index 71b9c10..aa10796 100644 --- a/include/dlt/dlt_common.h +++ b/include/dlt/dlt_common.h @@ -1618,6 +1618,14 @@ void dlt_getloginfo_conv_ascii_to_id(char *rp, int *rp_count, char *wp, int len) */ void dlt_hex_ascii_to_binary(const char *ptr, uint8_t *binary, int *size); +/** + * Helper function to execute the execvp function in a new child process. + * @param filename file path to store the stdout of command (NULL if not required) + * @param command execution command followed by arguments with NULL-termination + * @return negative value if there was an error + */ +int dlt_execute_command(char *filename, char *command, ...); + # ifdef __cplusplus } # endif -- cgit v1.2.1