Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys sy_invoke: cache the predicate value and simplify th...
details: https://anonhg.NetBSD.org/src/rev/e51fe0c683a7
branches: trunk
changeset: 787720:e51fe0c683a7
user: rmind <rmind%NetBSD.org@localhost>
date: Sat Jun 29 16:50:51 2013 +0000
description:
sy_invoke: cache the predicate value and simplify the logic (also, fix the
tab/space mess while here).
diffstat:
sys/sys/syscallvar.h | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diffs (50 lines):
diff -r b6fa4f04ec2d -r e51fe0c683a7 sys/sys/syscallvar.h
--- a/sys/sys/syscallvar.h Sat Jun 29 16:02:01 2013 +0000
+++ b/sys/sys/syscallvar.h Sat Jun 29 16:50:51 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscallvar.h,v 1.7 2013/06/26 08:30:40 matt Exp $ */
+/* $NetBSD: syscallvar.h,v 1.8 2013/06/29 16:50:51 rmind Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -68,27 +68,27 @@
sy_invoke(const struct sysent *sy, struct lwp *l, const void *uap,
register_t *rval, int code)
{
+ const bool do_trace = l->l_proc->p_trace_enabled &&
+ (sy->sy_flags & SYCALL_INDIRECT) == 0;
int error;
- if (!__predict_false(l->l_proc->p_trace_enabled)
- || __predict_false(sy->sy_flags & SYCALL_INDIRECT)
- || (error = trace_enter(code, uap, sy->sy_narg)) == 0) {
- rval[0] = 0;
+ if (__predict_true(!do_trace) || (error = trace_enter(code, uap,
+ sy->sy_narg)) == 0) {
+ rval[0] = 0;
#if !defined(__mips__)
/*
* Due to the mips userland code for SYS_break needing v1 to be
* preserved, we can't clear this on mips.
*/
- rval[1] = 0;
+ rval[1] = 0;
#endif
- error = sy_call(sy, l, uap, rval);
- }
-
- if (__predict_false(l->l_proc->p_trace_enabled)
- && !__predict_false(sy->sy_flags & SYCALL_INDIRECT)) {
- trace_exit(code, rval, error);
- }
- return error;
+ error = sy_call(sy, l, uap, rval);
+ }
+
+ if (__predict_false(do_trace)) {
+ trace_exit(code, rval, error);
+ }
+ return error;
}
/* inclusion in the kernel currently depends on SYSCALL_DEBUG */
Home |
Main Index |
Thread Index |
Old Index