On Wed, 2008-09-03 at 05:14 -0700, Roland McGrath 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.

Well, at least it is the right thing now. If anybody breaks it, let them
fix it later. Oh, and it couldn't be used by userland, because the
header file was not available.

Anyway, the saddest thing about this statement is that current users
don't need it at all, so if it's broken, nobody notices. You may just as
well simply return regs->ax, and everything continues to work the same
way it did before.

In other words, this would also work (but the API gets more ugly):

diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index abcf34c..e6e0f25 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -59,7 +59,9 @@ void syscall_rollback(struct task_struct *task, struct 
pt_regs *regs);
  * @task:      task of interest, must be blocked
  * @regs:      task_pt_regs() of @task
  *
- * Returns 0 if the system call succeeded, or -ERRORCODE if it failed.
+ * Returns the negative error code of a failed system call. Use
+ * IS_ERR_VALUE() on it to check whether the system call failed
+ * or succeeded.
  *
  * It's only valid to call this when @task is stopped for tracing on exit
  * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
diff --git a/include/asm-x86/syscall.h b/include/asm-x86/syscall.h
index 6f29389..1a89abb 100644
--- a/include/asm-x86/syscall.h
+++ b/include/asm-x86/syscall.h
@@ -47,7 +47,7 @@ static inline long syscall_get_error(struct task_struct *task,
                 */
                error = (long) (int) error;
 #endif
-       return error >= -4095L ? error : 0;
+       return error;
 }
 
 static inline long syscall_get_return_value(struct task_struct *task,


Reply via email to