implementation of syscall_get_error()

Ingo Molnar mingo at elte.hu
Fri Sep 5 15:53:53 UTC 2008


* Roland McGrath <roland at redhat.com> wrote:

> That's fine by me.  I was thinking of the definition of "errorness" as 
> arch-dependent magic, and just took the constant used in x86-specific 
> userland code that does this.  If IS_ERR_VALUE is always going to be 
> what's right on x86, by all means use it.

ok - i've applied the commit below to tip/x86/tracehook.

	Ingo

------------->
>From 4ab4ba32aa16b012cb0faabf1a27952508fe67f2 Mon Sep 17 00:00:00 2001
From: Petr Tesarik <ptesarik at suse.cz>
Date: Wed, 3 Sep 2008 13:31:42 +0200
Subject: [PATCH] x86, tracehook: clean up implementation of syscall_get_error()

The x86-tracehook code now contains this line in syscall_get_error():

	return error >= -4095L ? error : 0;

Hard-wiring a constant is not nice. Let's use the IS_ERR_VALUE macro
from linux/err.h instead.

Signed-off-by: Petr Tesarik <ptesarik at suse.cz>
Cc: utrace-devel at redhat.com
Acked-by: Roland McGrath <roland at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 include/asm-x86/syscall.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/asm-x86/syscall.h b/include/asm-x86/syscall.h
index 6f29389..04c47dc 100644
--- a/include/asm-x86/syscall.h
+++ b/include/asm-x86/syscall.h
@@ -14,6 +14,7 @@
 #define _ASM_SYSCALL_H	1
 
 #include <linux/sched.h>
+#include <linux/err.h>
 
 static inline long syscall_get_nr(struct task_struct *task,
 				  struct pt_regs *regs)
@@ -47,7 +48,7 @@ static inline long syscall_get_error(struct task_struct *task,
 		 */
 		error = (long) (int) error;
 #endif
-	return error >= -4095L ? error : 0;
+	return IS_ERR_VALUE(error) ? error : 0;
 }
 
 static inline long syscall_get_return_value(struct task_struct *task,




More information about the utrace-devel mailing list