Skip to contentSkip to conversation

getrlimit03: adjust a bit of code to compatiable with mips32

PATCH Superseded Hongzhi.Song 3 participants 4 messages Jul 15, 2019 – Jul 16, 2019

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 getrlimit03: adjust a bit of code to compatiable with mips32

V4:
Use better macro to filter mips32

V3:
The V2 break other arch. fix it.

V2:
modify commit log

Hongzhi.Song (1):
getrlimit03: adjust a bit of code to compatiable with mips32

 testcases/kernel/syscalls/getrlimit/getrlimit03.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Signature · 1 line
2.8.1
#1 lore raw

PATCH v4 1/1 getrlimit03: adjust a bit of code to compatiable with mips32

Error info:
getrlimit03.c:104: FAIL: __NR_prlimit64(0) had rlim_cur = ffffffffffffffff but __NR_getrlimit(0) had rlim_cur = 7fffffff

According to kernel code: [arch/mips/include/uapi/asm/resource.h] RLIM_INFINITY is set to 0x7fffffffUL instead of ULONG_MAX on mips32.

/*
* SuS says limits have to be unsigned.
* Which makes a ton more sense anyway,
* but we keep the old value on MIPS32,
* for compatibility:
*/
#ifndef __mips64

 # define RLIM_INFINITY      0x7fffffffUL
 #endif

Adding conditional statement about mips to fix this.

---
 testcases/kernel/syscalls/getrlimit/getrlimit03.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +7 -1
index e4d56c4..03bd821 100644
@@ -26,6 +26,7 @@
 
 #include "tst_test.h"
 #include "lapi/syscalls.h"
+#include "lapi/abisize.h"
 
 /**
  * Linux provides an "old" getrlimit syscall handler that uses signed long,
@@ -61,7 +62,12 @@ struct rlimit_ulong {
 	unsigned long rlim_cur;
 	unsigned long rlim_max;
 };
-const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+
+#if defined(__mips) && defined(TST_ABI32)
+	const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
+	const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
 
 static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
 {
Signature · 1 line
2.8.1
#2 lore raw

PATCH v4 1/1 getrlimit03: adjust a bit of code to compatiable with mips32

----- Original Message -----

Quoted 39 lines

Error info:
getrlimit03.c:104: FAIL: __NR_prlimit64(0) had rlim_cur = ffffffffffffffff but __NR_getrlimit(0) had rlim_cur = 7fffffff

According to kernel code: [arch/mips/include/uapi/asm/resource.h] RLIM_INFINITY is set to 0x7fffffffUL instead of ULONG_MAX on mips32.

/*
* SuS says limits have to be unsigned.
* Which makes a ton more sense anyway,
* but we keep the old value on MIPS32,
* for compatibility:
*/
#ifndef __mips64

 # define RLIM_INFINITY      0x7fffffffUL
 #endif

Adding conditional statement about mips to fix this.

---
 testcases/kernel/syscalls/getrlimit/getrlimit03.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -0
index e4d56c4..03bd821 100644
@@ -26,6 +26,7 @@
 
 #include "tst_test.h"
 #include "lapi/syscalls.h"
+#include "lapi/abisize.h"
 
 /**
  * Linux provides an "old" getrlimit syscall handler that uses signed long,

testcases/kernel/syscalls/getrlimit/getrlimit03.c struct rlimit_ulong { · line 66

Quoted 6 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +2 -1
@@ -61,7 +62,12 @@ struct rlimit_ulong {
 	unsigned long rlim_cur;
 	unsigned long rlim_max;
 };
-const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+
+#if defined(__mips) && defined(TST_ABI32)

I see several tests already use __mips__, why did you go with __mips here? Anyway, I'm fine with the patch.

Quoted 11 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +4 -1
+	const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
+	const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
 
 static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
 {
--

2.8.1

#3 lore raw

PATCH v4 1/1 getrlimit03: adjust a bit of code to compatiable with mips32

Quoted 38 lines · Jan Stancek

----- Original Message -----

Quoted 36 lines

Error info:
getrlimit03.c:104: FAIL: __NR_prlimit64(0) had rlim_cur = ffffffffffffffff but __NR_getrlimit(0) had rlim_cur = 7fffffff

According to kernel code: [arch/mips/include/uapi/asm/resource.h] RLIM_INFINITY is set to 0x7fffffffUL instead of ULONG_MAX on mips32.

/*
* SuS says limits have to be unsigned.
* Which makes a ton more sense anyway,
* but we keep the old value on MIPS32,
* for compatibility:
*/
#ifndef __mips64

  # define RLIM_INFINITY      0x7fffffffUL
  #endif

Adding conditional statement about mips to fix this.

---
  testcases/kernel/syscalls/getrlimit/getrlimit03.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -0
index e4d56c4..03bd821 100644
@@ -26,6 +26,7 @@
 
  #include "tst_test.h"
  #include "lapi/syscalls.h"
+#include "lapi/abisize.h"
 
Quoted 11 lines

testcases/kernel/syscalls/getrlimit/getrlimit03.c struct rlimit_ulong { · line 66

Quoted 9 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +2 -1
  /**
   * Linux provides an "old" getrlimit syscall handler that uses signed long,
@@ -61,7 +62,12 @@ struct rlimit_ulong {
  	unsigned long rlim_cur;
  	unsigned long rlim_max;
  };
-const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+
+#if defined(__mips) && defined(TST_ABI32)

I see several tests already use __mips__, why did you go with __mips here? Anyway, I'm fine with the patch.

I just find kernel uses __mips, but I will change to __mips__ with patch-v5.

Thanks.

--Hongzhi

Quoted 12 lines
Quoted 12 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +4 -1
+	const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
+	const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
 
  static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
  {
--

2.8.1