ltp: fix the link error raised by "proc.h" inclusion error

the link error are:
arm-none-eabi-ld: /home/guoshichao/work_profile/vela_os/vela_ltp_1/nuttx/staging/libapps.a(1-4.c.home.guoshichao.work_profile.vela_os.vela_ltp_1.apps.testing.ltp_3.o): in function `tst_process_state_wait3':
/home/guoshichao/work_profile/vela_os/vela_ltp_1/apps/testing/ltp/ltp/testcases/open_posix_testsuite/include/proc.h:63: multiple definition of `tst_process_state_wait3'; /home/guoshichao/work_profile/vela_os/vela_ltp_1/nuttx/staging/libapps.a(1-3.c.home.guoshichao.work_profile.vela_os.vela_ltp_1.apps.testing.ltp_3.o):/home/guoshichao/work_profile/vela_os/vela_ltp_1/apps/testing/ltp/ltp/testcases/open_posix_testsuite/include/proc.h:63: first defined here

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
This commit is contained in:
guoshichao 2024-07-07 15:58:02 +08:00 committed by Xiang Xiao
parent 12012f2276
commit 4e9ae2d45a
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,37 @@
From 6d38a0543d57f80954f9b2c2ec1f4a4c33b30894 Mon Sep 17 00:00:00 2001
From: guoshichao <guoshichao@xiaomi.com>
Date: Mon, 8 Jul 2024 16:38:22 +0800
Subject: [PATCH] ltp: fix the "tst_process_state_wait3" multi define error
VELAPLATFO-34850
fix the link error by making the "tst_process_state_wait3" to "static
inline" function
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
diff --git a/testcases/open_posix_testsuite/include/proc.h b/testcases/open_posix_testsuite/include/proc.h
index befb837..5d1d676 100644
--- a/testcases/open_posix_testsuite/include/proc.h
+++ b/testcases/open_posix_testsuite/include/proc.h
@@ -19,7 +19,7 @@
# include <errno.h>
# include <string.h>
-int tst_process_state_wait3(pid_t pid, const char state,
+static inline int tst_process_state_wait3(pid_t pid, const char state,
long maxwait_s)
{
char proc_path[128], cur_state;
@@ -58,7 +58,7 @@ int tst_process_state_wait3(pid_t pid, const char state,
return 1;
}
#else
-int tst_process_state_wait3(pid_t pid PTS_ATTRIBUTE_UNUSED,
+static inline int tst_process_state_wait3(pid_t pid PTS_ATTRIBUTE_UNUSED,
const char state PTS_ATTRIBUTE_UNUSED, long maxwait_s)
{
struct timespec maxwait_ts;
--
2.45.1

View File

@ -256,6 +256,7 @@ $(LTP_UNPACK): ltp-$(LTPS_VERSION).zip
$(Q) patch -d $(LTP_UNPACK) -p1 < 0008-test-ltp-fix-ltp_interfaces_sigaction_23_10-deadloop.patch
$(Q) patch -d $(LTP_UNPACK) -p1 < 0009-ltp-modify-user-code-for-fdcheck-compatibility.patch
$(Q) patch -d $(LTP_UNPACK) -p1 < 0010-ltp-fix-build-warning.patch
$(Q) patch -d $(LTP_UNPACK) -p1 < 0011-ltp-fix-the-proc.h-header-file-duplicate-inclusion.patch
# Download and unpack tarball if no git repo found
ifeq ($(wildcard $(LTP_UNPACK)/.git),)