Skip to contentSkip to conversation

getrlimit03: adjust a bit of code to compatiable with mips32

PATCH Superseded Hongzhi.Song 4 participants 9 messages Jul 11, 2019 – Jul 15, 2019

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +8 -2
index e4d56c4..1903558 100644
@@ -61,7 +61,13 @@ struct rlimit_ulong {
 	unsigned long rlim_cur;
 	unsigned long rlim_max;
 };
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
 const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
+#endif
 
 static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
 {
@@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, uint64_t val_u64,
 {
 	if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
 	    (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) {
-		tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",
-			resource, kind, val_u64,
+		tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d ULONG_MAX = %lu RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",
+			SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX, RLIM_INFINITY_UL, resource, kind, val_u64,
 			resource, kind, val_ul);
 		return -1;
 	}
Signature · 1 line
2.8.1
#1 lore raw

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

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

Quoted 30 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 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -0
index e4d56c4..1903558 100644

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

Quoted 10 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +6 -0
@@ -61,7 +61,13 @@ struct rlimit_ulong {
 	unsigned long rlim_cur;
 	unsigned long rlim_max;
 };
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
 const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
+#endif

Hi,

This will break every other arch, because it's now undefined everywhere except mips.

Quoted 14 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -2
 static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
 {
@@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, uint64_t
 val_u64,
 {
 	if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
 	    (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) {
-		tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but "
 __NR_getrlimit_ulong_str "(%d) had %s = %lx",
-			resource, kind, val_u64,
+		tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d ULONG_MAX = %lu

RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",

testcases/kernel/syscalls/getrlimit/getrlimit03.c

Quoted 1 line
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -0
+			SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX, RLIM_INFINITY_UL, resource,

I suggest to split it into another tst_res() message, line above is nearly 200 characters.

Regards,
Jan

Quoted 11 lines

kind, val_u64,

testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -1
 			resource, kind, val_ul);
 		return -1;
 	}
--

2.8.1

--
Mailing list info: https://lists.linux.it/listinfo/ltp

#2 lore raw

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

Quoted 44 lines · Jan Stancek

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

Quoted 30 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 | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -0
index e4d56c4..1903558 100644

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

Quoted 10 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +6 -0
@@ -61,7 +61,13 @@ struct rlimit_ulong {
  	unsigned long rlim_cur;
  	unsigned long rlim_max;
  };
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
  const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
+#endif

Hi,

Quoted 1 line

This will break every other arch, because it's now undefined everywhere except mips.

Is there a good way to filter mips32?

I tried

?65 #ifdef __mips
?66 #ifndef __mips64
?67 const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL; ?68 #endif
?69 const unsigned long RLIM_INFINITY_UL = ULONG_MAX; ?70 #else
?71 const unsigned long RLIM_INFINITY_UL = ULONG_MAX; ?72 #endif

but mips32 thinks the RLIM_INFINITY_UL micro is redefined.

Quoted 17 lines
Quoted 15 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -2
  static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
  {
@@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, uint64_t
 val_u64,
  {
  	if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
  	    (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) {
-		tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but "
 __NR_getrlimit_ulong_str "(%d) had %s = %lx",
-			resource, kind, val_u64,
+		tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d ULONG_MAX = %lu

RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",

testcases/kernel/syscalls/getrlimit/getrlimit03.c

Quoted 1 line
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -0
+			SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX, RLIM_INFINITY_UL, resource,

I suggest to split it into another tst_res() message, line above is nearly 200 characters.

Sorry, I shouldn't append debug code to patch.

--Hongzhi

Quoted 15 lines

Regards,
Jan

Quoted 11 lines

kind, val_u64,
resource, kind, val_ul);
return -1;
}
--
2.8.1

--
Mailing list info: https://lists.linux.it/listinfo/ltp

#3 lore raw

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

Quoted 63 lines · Song
Quoted 44 lines · Jan Stancek

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

Quoted 30 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 | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -0
index e4d56c4..1903558 100644

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

Quoted 10 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +6 -0
@@ -61,7 +61,13 @@ struct rlimit_ulong {
      unsigned long rlim_cur;
      unsigned long rlim_max;
  };
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
  const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
+#endif

Hi,

Quoted 2 lines

This will break every other arch, because it's now undefined everywhere except mips.

Is there a good way to filter mips32?

I tried

65 #ifdef __mips
66 #ifndef __mips64
67 const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL; 68 #endif
69 const unsigned long RLIM_INFINITY_UL = ULONG_MAX; 70 #else
71 const unsigned long RLIM_INFINITY_UL = ULONG_MAX; 72 #endif

Quoted 1 line

but mips32 thinks the RLIM_INFINITY_UL micro is redefined.

Hi hongzhi

You redefine RLIM_INFINITY_UL macro indeed when on mips32 because line 67 and 69.

It should be as below:
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL; #endif
+#else
+const unsigned long RLIM_INFINITY_UL = ULONG_MAX; +#endif

Quoted 44 lines
Quoted 13 lines
Quoted 13 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -2
    static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
  {
@@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, uint64_t
 val_u64,
  {
      if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
          (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) {
-        tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but "
 __NR_getrlimit_ulong_str "(%d) had %s = %lx",
-            resource, kind, val_u64,
Quoted 8 lines
Quoted 6 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -0
+        tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d 

ULONG_MAX = %lu
RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",
+ SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX,
RLIM_INFINITY_UL, resource,

I suggest to split it into another tst_res() message, line above is nearly 200 characters.

Sorry, I shouldn't append debug code to patch.

--Hongzhi

Quoted 15 lines

Regards,
Jan

Quoted 11 lines

kind, val_u64,

              resource, kind, val_ul);
          return -1;
      }
Signature · 5 lines
2.8.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

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

Quoted 77 lines · Yang Xu
Quoted 63 lines · Song
Quoted 44 lines · Jan Stancek

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

Quoted 30 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 | 10 ++++++++-- ? 1 file changed, 8 insertions(+), 2 deletions(-)

testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -0
index e4d56c4..1903558 100644

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

Quoted 10 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +6 -0
@@ -61,7 +61,13 @@ struct rlimit_ulong {
 ????? unsigned long rlim_cur;
 ????? unsigned long rlim_max;
 ? };
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
 ? const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
+#endif

Hi,

Quoted 2 lines

This will break every other arch, because it's now undefined everywhere except mips.

Is there a good way to filter mips32?

I tried

?65 #ifdef __mips
?66 #ifndef __mips64
?67 const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL; ?68 #endif
?69 const unsigned long RLIM_INFINITY_UL = ULONG_MAX; ?70 #else
?71 const unsigned long RLIM_INFINITY_UL = ULONG_MAX; ?72 #endif

Quoted 1 line

but mips32 thinks the RLIM_INFINITY_UL micro is redefined.

Hi hongzhi

You redefine RLIM_INFINITY_UL macro indeed when on mips32 because line 67 and 69.

It should be as below:

testcases/kernel/syscalls/getrlimit/getrlimit03.c +3 -0
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;

#endif

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

Quoted 3 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +3 -0
+#else
+const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif

Thanks for your reply.

But this will exclude mips64.

--Hongzhi

Quoted 53 lines
Quoted 49 lines
Quoted 18 lines
Quoted 18 lines

??? static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
? {

testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -0
@@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, 

uint64_t
val_u64,
? {
????? if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
????????? (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) { -??????? tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",
-??????????? resource, kind, val_u64,

Quoted 8 lines
Quoted 6 lines

+??????? tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d ULONG_MAX = %lu
RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx", +??????????? SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX, RLIM_INFINITY_UL, resource,

I suggest to split it into another tst_res() message, line above is nearly 200 characters.

Sorry, I shouldn't append debug code to patch.

--Hongzhi

Quoted 15 lines

Regards,
Jan

Quoted 11 lines

kind, val_u64,
????????????? resource, kind, val_ul);
????????? return -1;
????? }

Signature · 5 lines
2.8.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

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

In reply to Hongzhi

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

Quoted 46 lines · Jan Stancek
Quoted 44 lines

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

Quoted 30 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 | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -0
index e4d56c4..1903558 100644

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

Quoted 10 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +6 -0
@@ -61,7 +61,13 @@ struct rlimit_ulong {
  	unsigned long rlim_cur;
  	unsigned long rlim_max;
  };
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
  const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
+#endif

Hi,

Quoted 5 lines
Quoted 2 lines

This will break every other arch, because it's now undefined everywhere except mips.

Is there a good way to filter mips32?

Maybe something like:

#include "lapi/abisize.h"

#if defined(__mips__) && defined(TST_ABI32) const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL; #else
const unsigned long RLIM_INFINITY_UL = ULONG_MAX; #endif

Quoted 56 lines

I tried

?65 #ifdef __mips
?66 #ifndef __mips64
?67 const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL; ?68 #endif
?69 const unsigned long RLIM_INFINITY_UL = ULONG_MAX; ?70 #else
?71 const unsigned long RLIM_INFINITY_UL = ULONG_MAX; ?72 #endif

but mips32 thinks the RLIM_INFINITY_UL micro is redefined.

Quoted 18 lines
Quoted 15 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -2
  static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
  {
@@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, uint64_t
 val_u64,
  {
  	if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
  	    (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) {
-		tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but "
 __NR_getrlimit_ulong_str "(%d) had %s = %lx",
-			resource, kind, val_u64,
+		tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d ULONG_MAX = %lu

RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",

testcases/kernel/syscalls/getrlimit/getrlimit03.c

Quoted 1 line
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -0
+			SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX, RLIM_INFINITY_UL, resource,

I suggest to split it into another tst_res() message, line above is nearly 200 characters.

Sorry, I shouldn't append debug code to patch.

--Hongzhi

Quoted 15 lines

Regards,
Jan

Quoted 11 lines

kind, val_u64,
resource, kind, val_ul);
return -1;
}
--
2.8.1

--
Mailing list info: https://lists.linux.it/listinfo/ltp

#6 lore raw

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

Quoted 51 lines · Jan Stancek

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

Quoted 44 lines · Jan Stancek
Quoted 43 lines

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

Quoted 30 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 | 10 ++++++++--
   1 file changed, 8 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -0
index e4d56c4..1903558 100644

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

Quoted 10 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +6 -0
@@ -61,7 +61,13 @@ struct rlimit_ulong {
   	unsigned long rlim_cur;
   	unsigned long rlim_max;
   };
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
   const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
+#endif

Hi,

Quoted 4 lines
Quoted 2 lines

This will break every other arch, because it's now undefined everywhere except mips.

Is there a good way to filter mips32?

Maybe something like:

Quoted 7 lines

#include "lapi/abisize.h"

#if defined(__mips__) && defined(TST_ABI32) const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL; #else
const unsigned long RLIM_INFINITY_UL = ULONG_MAX; #endif

TST_ABI32 looks like not work, and I sent patch-V3 using __mips and __mips64.

--Hongzhi

Quoted 52 lines
Quoted 52 lines

I tried

  ?65 #ifdef __mips
  ?66 #ifndef __mips64
  ?67 const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
  ?68 #endif
  ?69 const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
  ?70 #else
  ?71 const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
  ?72 #endif

but mips32 thinks the RLIM_INFINITY_UL micro is redefined.

Quoted 17 lines
Quoted 14 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -2
   static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
   {
@@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, uint64_t
 val_u64,
   {
   	if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
   	    (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) {
-		tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but "
 __NR_getrlimit_ulong_str "(%d) had %s = %lx",
-			resource, kind, val_u64,
+		tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d ULONG_MAX = %lu

RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",

testcases/kernel/syscalls/getrlimit/getrlimit03.c

Quoted 1 line
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -0
+			SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX, RLIM_INFINITY_UL, resource,

I suggest to split it into another tst_res() message, line above is nearly 200 characters.

Sorry, I shouldn't append debug code to patch.

--Hongzhi

Quoted 14 lines

Regards,
Jan

Quoted 11 lines

kind, val_u64,

   			resource, kind, val_ul);
   		return -1;
   	}

--
2.8.1

--
Mailing list info: https://lists.linux.it/listinfo/ltp

#7 lore raw

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

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

Quoted 55 lines · Jan Stancek
Quoted 53 lines

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

Quoted 44 lines · Jan Stancek
Quoted 43 lines

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

Quoted 30 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 | 10 ++++++++--
   1 file changed, 8 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -0
index e4d56c4..1903558 100644

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

Quoted 10 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +6 -0
@@ -61,7 +61,13 @@ struct rlimit_ulong {
   	unsigned long rlim_cur;
   	unsigned long rlim_max;
   };
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
   const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
+#endif

Hi,

Quoted 4 lines
Quoted 2 lines

This will break every other arch, because it's now undefined everywhere except mips.

Is there a good way to filter mips32?

Maybe something like:

#include "lapi/abisize.h"

Quoted 8 lines
Quoted 5 lines

#if defined(__mips__) && defined(TST_ABI32) const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL; #else
const unsigned long RLIM_INFINITY_UL = ULONG_MAX; #endif

TST_ABI32 looks like not work

Can you elaborate?

Quoted 59 lines

, and I sent patch-V3 using __mips and __mips64.

--Hongzhi

Quoted 53 lines
Quoted 53 lines

I tried

  ?65 #ifdef __mips
  ?66 #ifndef __mips64
  ?67 const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
  ?68 #endif
  ?69 const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
  ?70 #else
  ?71 const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
  ?72 #endif

but mips32 thinks the RLIM_INFINITY_UL micro is redefined.

Quoted 10 lines
Quoted 10 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -1
   static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
   {
@@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, uint64_t
 val_u64,
   {
   	if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
   	    (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) {
-		tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but "
 __NR_getrlimit_ulong_str "(%d) had %s = %lx",
Quoted 8 lines

testcases/kernel/syscalls/getrlimit/getrlimit03.c

Quoted 5 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -1
-			resource, kind, val_u64,
+		tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d ULONG_MAX = %lu

RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",

testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -0
+			SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX, RLIM_INFINITY_UL, resource,

I suggest to split it into another tst_res() message, line above is nearly
200 characters.

Sorry, I shouldn't append debug code to patch.

--Hongzhi

Quoted 14 lines

Regards,
Jan

Quoted 11 lines

kind, val_u64,

   			resource, kind, val_ul);
   		return -1;
   	}

--
2.8.1

--
Mailing list info: https://lists.linux.it/listinfo/ltp

#8 lore raw

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

Quoted 55 lines · Jan Stancek

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

Quoted 53 lines · Jan Stancek
Quoted 52 lines

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

Quoted 44 lines · Jan Stancek
Quoted 43 lines

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

Quoted 30 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 | 10 ++++++++--
    1 file changed, 8 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -0
index e4d56c4..1903558 100644

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

Quoted 10 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +6 -0
@@ -61,7 +61,13 @@ struct rlimit_ulong {
    	unsigned long rlim_cur;
    	unsigned long rlim_max;
    };
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
    const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
+#endif

Hi,

Quoted 3 lines
Quoted 2 lines

This will break every other arch, because it's now undefined everywhere except mips.

Is there a good way to filter mips32?

Maybe something like:

#include "lapi/abisize.h"

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

#if defined(__mips__) && defined(TST_ABI32) const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL; #else
const unsigned long RLIM_INFINITY_UL = ULONG_MAX; #endif

TST_ABI32 looks like not work

Can you elaborate?

Thanks for your patient instruction.

Now it passes with your suggestion.

Previously, my ltp project is too old to missing lapi/abisize.h.

I have sent patch-v4, please review it.

--Hongzhi

Quoted 57 lines
Quoted 57 lines

, and I sent patch-V3 using __mips and __mips64.

--Hongzhi

Quoted 51 lines
Quoted 51 lines

I tried

   ?65 #ifdef __mips
   ?66 #ifndef __mips64
   ?67 const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
   ?68 #endif
   ?69 const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
   ?70 #else
   ?71 const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
   ?72 #endif

but mips32 thinks the RLIM_INFINITY_UL micro is redefined.

Quoted 10 lines
Quoted 10 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +0 -1
    static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
    {
@@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, uint64_t
 val_u64,
    {
    	if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
    	    (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) {
-		tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but "
 __NR_getrlimit_ulong_str "(%d) had %s = %lx",
Quoted 8 lines

testcases/kernel/syscalls/getrlimit/getrlimit03.c

Quoted 5 lines
testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -1
-			resource, kind, val_u64,
+		tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d ULONG_MAX = %lu

RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",

testcases/kernel/syscalls/getrlimit/getrlimit03.c +1 -0
+			SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX, RLIM_INFINITY_UL, resource,

I suggest to split it into another tst_res() message, line above is nearly
200 characters.

Sorry, I shouldn't append debug code to patch.

--Hongzhi

Quoted 14 lines

Regards,
Jan

Quoted 11 lines

kind, val_u64,

    			resource, kind, val_ul);
    		return -1;
    	}

--
2.8.1

--
Mailing list info: https://lists.linux.it/listinfo/ltp