[PATCH] Handle biarch get/setrlimit
Andreas Schwab
schwab at linux-m68k.org
Sat Jul 17 15:22:12 UTC 2010
* resource.c (print_rlimit32) [POWERPC64 || X86_64]: Define.
(sys_getrlimit, sys_setrlimit) [POWERPC64 || X86_64]: Use it.
---
resource.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/resource.c b/resource.c
index 8274f3e..147638b 100644
--- a/resource.c
+++ b/resource.c
@@ -122,6 +122,28 @@ sprintrlim(long lim)
return buf;
}
+# if defined LINUX && (defined POWERPC64 || defined X86_64)
+static void
+print_rlimit32(struct tcb *tcp)
+{
+ struct rlimit32 {
+ unsigned int rlim_cur;
+ unsigned int rlim_max;
+ } rlim;
+
+ if (umove(tcp, tcp->u_arg[1], &rlim) < 0)
+ tprintf("{...}");
+ else {
+ tprintf("{rlim_cur=%s,",
+ sprintrlim(rlim.rlim_cur == -1 ? RLIM_INFINITY
+ : rlim.rlim_cur));
+ tprintf(" rlim_max=%s}",
+ sprintrlim(rlim.rlim_max == -1 ? RLIM_INFINITY
+ : rlim.rlim_max));
+ }
+}
+#endif
+
int
sys_getrlimit(struct tcb *tcp)
{
@@ -134,6 +156,10 @@ sys_getrlimit(struct tcb *tcp)
else {
if (syserror(tcp) || !verbose(tcp))
tprintf("%#lx", tcp->u_arg[1]);
+# if defined LINUX && (defined POWERPC64 || defined X86_64)
+ else if (current_personality == 1)
+ print_rlimit32(tcp);
+# endif
else if (umove(tcp, tcp->u_arg[1], &rlim) < 0)
tprintf("{...}");
else {
@@ -154,6 +180,10 @@ sys_setrlimit(struct tcb *tcp)
tprintf(", ");
if (!verbose(tcp))
tprintf("%#lx", tcp->u_arg[1]);
+# if defined LINUX && (defined POWERPC64 || defined X86_64)
+ else if (current_personality == 1)
+ print_rlimit32(tcp);
+# endif
else if (umove(tcp, tcp->u_arg[1], &rlim) < 0)
tprintf("{...}");
else {
--
1.7.1.1
--
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Strace-devel
mailing list