Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Elide [NUM] in arguments for systrace, use the firs...



details:   https://anonhg.NetBSD.org/src/rev/b89d6e6ce3c4
branches:  trunk
changeset: 961636:b89d6e6ce3c4
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Apr 13 22:45:32 2021 +0000

description:
Elide [NUM] in arguments for systrace, use the first address of the array
and cast to intptr_t instead.

diffstat:

 sys/kern/makesyscalls.sh |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r edb5807e42b4 -r b89d6e6ce3c4 sys/kern/makesyscalls.sh
--- a/sys/kern/makesyscalls.sh  Tue Apr 13 22:24:56 2021 +0000
+++ b/sys/kern/makesyscalls.sh  Tue Apr 13 22:45:32 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: makesyscalls.sh,v 1.183 2021/02/17 06:25:10 rillig Exp $
+#      $NetBSD: makesyscalls.sh,v 1.184 2021/04/13 22:45:32 christos Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -805,6 +805,15 @@
            syscall, wfn, funcalias, rumpentry) > rumpsysmap
 }
 
+function fixarray(arg) {
+       iii = index(arg, "[")
+       if (iii == 0) {
+               return arg
+       } else {
+               return substr(arg, 1, iii - 1)
+       }
+}
+
 function putsystrace(type, compatwrap_) {
        printf("\t/* %s */\n\tcase %d: {\n", funcname, syscall) > systrace
        printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systracetmp
@@ -822,10 +831,10 @@
                                     i - 1, \
                                     argname[i], arg) > systrace
                        else if (index(arg, "*") > 0 || arg == "caddr_t" ||
-                           arg ~ /.*_handler_t$/)
+                           arg ~ /.*_handler_t$/ || index(argname[i], "[") > 0)
                                printf("\t\tuarg[%d] = (intptr_t) SCARG(p, %s); /* %s */\n", \
                                     i - 1, \
-                                    argname[i], arg) > systrace
+                                    fixarray(argname[i]), arg) > systrace
                        else if (substr(arg, 1, 1) == "u" || arg == "size_t")
                                printf("\t\tuarg[%d] = SCARG(p, %s); /* %s */\n", \
                                     i - 1, \



Home | Main Index | Thread Index | Old Index