From 3259b7d70019721212b864d4ade97be5bdc6e27b Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Wed, 23 Mar 2022 01:45:25 +0800 Subject: [PATCH] tools/jlink: Change the type of pid from uint16_t to uint32_t follow up the bellow chnage: commit 0f2f48f8bae0e13f7927ed70c3711d03fe6d5f27 Author: Xiang Xiao Date: Sun Mar 20 18:12:26 2022 +0800 sys/type.h: Change pid_t from int16_t to int to fix the following warning: include/unistd.h:302:9: error: incompatible redeclaration of library function 'vfork' [-Werror,-Wincompatible-library-redeclaration] pid_t vfork(void); ^ include/unistd.h:302:9: note: 'vfork' is a builtin with type 'int (void)' and change 32768 to INT_MAX to match the type change Signed-off-by: Xiang Xiao --- tools/jlink-nuttx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/jlink-nuttx.c b/tools/jlink-nuttx.c index 8b3ee4eaba..0e817888ef 100644 --- a/tools/jlink-nuttx.c +++ b/tools/jlink-nuttx.c @@ -207,11 +207,11 @@ static inline uint32_t decode_hex(const char *line) } static int get_pid(struct plugin_priv_s *priv, uint32_t idx, - uint16_t *pid) + uint32_t *pid) { int ret; - ret = READU16(priv->pidhash[idx] + priv->tcbinfo->pid_off, pid); + ret = READU32(priv->pidhash[idx] + priv->tcbinfo->pid_off, pid); if (ret != 0) { PERROR("read %d pid error return %d\n", idx, ret); @@ -228,7 +228,7 @@ static int get_idx_from_pid(struct plugin_priv_s *priv, for (idx = 0; idx < priv->ntcb; idx++) { - uint16_t tmppid; + uint32_t tmppid; if (get_pid(priv, idx, &tmppid)) { @@ -466,7 +466,7 @@ uint32_t RTOS_GetThreadId(uint32_t n) { if (n < g_plugin_priv.ntcb) { - uint16_t pid; + uint32_t pid; if (get_pid(&g_plugin_priv, n, &pid) == 0) {