aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-06-29 01:05:31 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-06-29 01:05:31 +0000
commit377f2bd61766fdddaeed4fdaca5c279f7386e49c (patch)
treedc99b8d2649bf2bbdb34cad32c778ac254a47634
parentf8ec929bc27407637ddaa627bab69a269a117342 (diff)
parentd8fb78b33624ef3709e6990066d25b971d291439 (diff)
downloadltp-377f2bd61766fdddaeed4fdaca5c279f7386e49c.tar.gz
Change-Id: Ib09498cc375925964f2ae2b1ea6b99dc5ae9c7bd
-rw-r--r--testcases/kernel/syscalls/getrlimit/getrlimit03.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/testcases/kernel/syscalls/getrlimit/getrlimit03.c b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
index 319bc494a..604082ccf 100644
--- a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
+++ b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
@@ -35,14 +35,20 @@
* The underlying syscall names vary across architectures, depending on whether
* the architecture predates the "new" handler. For clarity, this test
* will call them getrlimit_long and getlimit_ulong internally.
+ *
+ * __NR_getrlimit has been deprecated from arm EABI and moved to OABI_COMPAT,
+ * so the syscall on arm may or may not be available even if __NR_ugetrlimit
+ * exists.
*/
-#define SIGNED_GETRLIMIT (__NR_ugetrlimit != __LTP__NR_INVALID_SYSCALL)
-#if SIGNED_GETRLIMIT
-#define __NR_getrlimit_ulong __NR_ugetrlimit
-#define __NR_getrlimit_ulong_str "__NR_ugetrlimit"
+#if __NR_ugetrlimit != __LTP__NR_INVALID_SYSCALL
+# if !defined(__arm__) || __NR_getrlimit != __LTP__NR_INVALID_SYSCALL
+# define SIGNED_GETRLIMIT
+# endif
+# define __NR_getrlimit_ulong __NR_ugetrlimit
+# define __NR_getrlimit_ulong_str "__NR_ugetrlimit"
#else
-#define __NR_getrlimit_ulong __NR_getrlimit
-#define __NR_getrlimit_ulong_str "__NR_getrlimit"
+# define __NR_getrlimit_ulong __NR_getrlimit
+# define __NR_getrlimit_ulong_str "__NR_getrlimit"
#endif
#ifndef HAVE_STRUCT_RLIMIT64
@@ -74,12 +80,13 @@ static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
return syscall(__NR_getrlimit_ulong, resource, rlim);
}
-#if SIGNED_GETRLIMIT
+const long RLIM_INFINITY_L = LONG_MAX;
+
+#ifdef SIGNED_GETRLIMIT
struct rlimit_long {
long rlim_cur;
long rlim_max;
};
-const long RLIM_INFINITY_L = LONG_MAX;
static int getrlimit_long(int resource, struct rlimit_long *rlim)
{
@@ -116,7 +123,7 @@ static int compare_u64_ulong(int resource, uint64_t val_u64,
return 0;
}
-#if SIGNED_GETRLIMIT
+#ifdef SIGNED_GETRLIMIT
static int compare_u64_long(int resource, uint64_t val_u64, long val_l,
const char *kind)
{
@@ -142,7 +149,7 @@ static void run(unsigned int resource)
int ret_ul;
int errno_ul;
-#if SIGNED_GETRLIMIT
+#ifdef SIGNED_GETRLIMIT
struct rlimit_long rlim_l;
int ret_l;
int errno_l;
@@ -167,7 +174,7 @@ static void run(unsigned int resource)
tst_res(TPASS, "__NR_prlimit64(%d) and %s(%d) gave consistent results",
resource, __NR_getrlimit_ulong_str, resource);
-#if SIGNED_GETRLIMIT
+#ifdef SIGNED_GETRLIMIT
errno = 0;
ret_l = getrlimit_long(resource, &rlim_l);
errno_l = errno;