From: Greg Hackmann <ghackmann@google.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] getrlimit/getrlimit03: add configure-time check for struct ulimit64
Date: Mon, 3 Dec 2018 11:01:47 -0800 [thread overview]
Message-ID: <20181203190148.93108-1-ghackmann@google.com> (raw)
The kernel's UAPI headers export a definition of struct ulimit64 which
can conflict with the open-coded one in getrlimit03. Fix this by moving
getrlimit03's definition behind a configure-time check.
Signed-off-by: Greg Hackmann <ghackmann@google.com>
---
configure.ac | 1 +
m4/ltp-rlimit64.m4 | 10 ++++++++++
testcases/kernel/syscalls/getrlimit/getrlimit03.c | 2 ++
3 files changed, 13 insertions(+)
create mode 100644 m4/ltp-rlimit64.m4
diff --git a/configure.ac b/configure.ac
index e81d2add5..caea34462 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,6 +228,7 @@ LTP_CHECK_UNAME_DOMAINNAME
LTP_CHECK_X_TABLES
LTP_CHECK_ATOMIC_MEMORY_MODEL
LTP_CHECK_TPACKET_V3
+LTP_CHECK_RLIMIT64
LTP_DETECT_HOST_CPU
LTP_CHECK_PERF_EVENT
diff --git a/m4/ltp-rlimit64.m4 b/m4/ltp-rlimit64.m4
new file mode 100644
index 000000000..f2e6c526a
--- /dev/null
+++ b/m4/ltp-rlimit64.m4
@@ -0,0 +1,10 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2018 Google, Inc.
+
+AC_DEFUN([LTP_CHECK_RLIMIT64],[
+AC_CHECK_TYPES([struct rlimit64],,,[
+#include <sys/time.h>
+#include <sys/resource.h>
+])
+])
+
diff --git a/testcases/kernel/syscalls/getrlimit/getrlimit03.c b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
index 9ff28acb6..376ef7241 100644
--- a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
+++ b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
@@ -44,10 +44,12 @@
#define __NR_getrlimit_ulong_str "__NR_getrlimit"
#endif
+#ifndef HAVE_STRUCT_RLIMIT64
struct rlimit64 {
uint64_t rlim_cur;
uint64_t rlim_max;
};
+#endif
const uint64_t RLIM_INFINITY_U64 = UINT64_MAX;
static int getrlimit_u64(int resource, struct rlimit64 *rlim)
--
2.20.0.rc1.387.gf8505762e3-goog
next reply other threads:[~2018-12-03 19:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 19:01 Greg Hackmann [this message]
2018-12-03 19:01 ` [LTP] [PATCH 2/2] getrlimit/getrlimit03: add test to runtest/syscalls Greg Hackmann
2018-12-03 20:34 ` Petr Vorel
2018-12-03 21:25 ` [LTP] [PATCH 1/2] getrlimit/getrlimit03: add configure-time check for struct ulimit64 Petr Vorel
2018-12-03 22:20 ` Greg Hackmann
2018-12-04 9:01 ` Petr Vorel
2018-12-04 17:34 ` Greg Hackmann
2018-12-05 16:47 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181203190148.93108-1-ghackmann@google.com \
--to=ghackmann@google.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox