Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode/usermode if syscallemu returns -1 and sets...



details:   https://anonhg.NetBSD.org/src/rev/c7d9d96e146c
branches:  trunk
changeset: 772764:c7d9d96e146c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jan 15 10:35:08 2012 +0000

description:
if syscallemu returns -1 and sets errno = EACCES, it means it's already
enabled for this pid. don't treat this as a failure.

diffstat:

 sys/arch/usermode/usermode/thunk.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r 5d27dfb49714 -r c7d9d96e146c sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c        Sun Jan 15 10:30:21 2012 +0000
+++ b/sys/arch/usermode/usermode/thunk.c        Sun Jan 15 10:35:08 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.78 2012/01/14 17:42:52 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.79 2012/01/15 10:35:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.78 2012/01/14 17:42:52 reinoud Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.79 2012/01/15 10:35:08 jmcneill Exp $");
 #endif
 
 #include <sys/types.h>
@@ -113,10 +113,12 @@
 {
        int error;
 
-       fprintf(stdout, "%s: syscall(%d, %p, %p)\n", __func__,
-           SYS_syscallemu, ustart, uend);
+       errno = 0;
        error = syscall(SYS_syscallemu, (uintptr_t)ustart, (uintptr_t)uend);
-       fprintf(stdout, "%s: returned %d\n", __func__, error);
+       if (error == -1 && errno == EACCES) {
+               /* syscallemu already active for this pid */
+               error = 0;
+       }
 
        return error;
 }



Home | Main Index | Thread Index | Old Index