[PATCH] Optimize known_scno()

Dmitry V. Levin ldv at altlinux.org
Sat Feb 19 00:41:35 UTC 2011


* syscall.c (known_scno): Do not check for native_scno field on
platforms that support only one personality.
---
native_scno was implemented for platforms with multiple personalities.
On platforms that support only one personality,
tcp->scno + NR_SYSCALL_BASE is already native.

native_scno is currently initialized in 4 syscallent.h files, but only
linux/i386/syscallent.h really have to use it, and other 3 of them
(linux/bfin/syscallent.h, linux/m68k/syscallent.h and
linux/microblaze/syscallent.h) don't really have to bother.
I suppose it's a result of cut-n-paste.

 syscall.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/syscall.c b/syscall.c
index dc82b2a..79d3b4a 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1326,13 +1326,14 @@ get_scno(struct tcb *tcp)
 
 
 long
-known_scno(tcp)
-struct tcb *tcp;
+known_scno(struct tcb *tcp)
 {
 	long scno = tcp->scno;
+#if SUPPORTED_PERSONALITIES > 1
 	if (scno >= 0 && scno < nsyscalls && sysent[scno].native_scno != 0)
 		scno = sysent[scno].native_scno;
 	else
+#endif
 		scno += NR_SYSCALL_BASE;
 	return scno;
 }


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20110219/72f3f835/attachment.bin>


More information about the Strace-devel mailing list