blob: aecbc80e9b56bd8d3da1e83f8791bb33cf8eadde [file] [log] [blame]
Brad Bishop96ff1982019-08-19 13:50:42 -04001From 4ac747c1f7ff8e2ec2567d6672822e95a9b56e55 Mon Sep 17 00:00:00 2001
2From: "Hongzhi.Song" <hongzhi.song@windriver.com>
3Date: Mon, 15 Jul 2019 03:39:06 -0400
4Subject: [PATCH] getrlimit03: adjust a bit of code to compatiable with mips32
5
6Error info:
7getrlimit03.c:104: FAIL: __NR_prlimit64(0) had rlim_cur =
8ffffffffffffffff but __NR_getrlimit(0) had rlim_cur = 7fffffff
9
10According to kernel code: [arch/mips/include/uapi/asm/resource.h]
11RLIM_INFINITY is set to 0x7fffffffUL instead of ULONG_MAX on mips32.
12
13 /*
14 * SuS says limits have to be unsigned.
15 * Which makes a ton more sense anyway,
16 * but we keep the old value on MIPS32,
17 * for compatibility:
18 */
19 #ifndef __mips64
20 # define RLIM_INFINITY 0x7fffffffUL
21 #endif
22
23Adding conditional statement about mips to fix this.
24
25Signed-off-by: Jan Stancek <jstancek@redhat.com>
26Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
27
28Upstream-Status: Backport
29[https://github.com/linux-test-project/ltp/commit/7a3bca63cd7f059d490b6274f0fdf3247be93fde]
30
31Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
32---
33 testcases/kernel/syscalls/getrlimit/getrlimit03.c | 8 +++++++-
34 1 file changed, 7 insertions(+), 1 deletion(-)
35
36diff --git a/testcases/kernel/syscalls/getrlimit/getrlimit03.c b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
37index e4d56c4..319bc49 100644
38--- a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
39+++ b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
40@@ -26,6 +26,7 @@
41
42 #include "tst_test.h"
43 #include "lapi/syscalls.h"
44+#include "lapi/abisize.h"
45
46 /**
47 * Linux provides an "old" getrlimit syscall handler that uses signed long,
48@@ -61,7 +62,12 @@ struct rlimit_ulong {
49 unsigned long rlim_cur;
50 unsigned long rlim_max;
51 };
52-const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
53+
54+#if defined(__mips__) && defined(TST_ABI32)
55+ const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
56+#else
57+ const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
58+#endif
59
60 static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
61 {
62--
632.7.4
64