Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet Replace llx with PRIx64 and some llu wit...



details:   https://anonhg.NetBSD.org/src/rev/9d76d02cb249
branches:  trunk
changeset: 325938:9d76d02cb249
user:      riz <riz%NetBSD.org@localhost>
date:      Sun Jan 12 17:49:30 2014 +0000

description:
Replace llx with PRIx64 and some llu with PRIu64 in format strings.

diffstat:

 external/cddl/osnet/dev/systrace/systrace.c                |  68 +++++++++++--
 external/cddl/osnet/dist/lib/libdtrace/common/dt_consume.c |  34 +++---
 external/cddl/osnet/dist/lib/libdtrace/common/dt_dis.c     |   9 +-
 external/cddl/osnet/dist/lib/libdtrace/common/dt_handle.c  |   7 +-
 external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c    |   2 +-
 external/cddl/osnet/dist/lib/libdtrace/common/dt_options.c |   2 +-
 external/cddl/osnet/dist/lib/libdtrace/common/dt_parser.c  |  12 +-
 external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c    |  20 ++--
 8 files changed, 97 insertions(+), 57 deletions(-)

diffs (truncated from 477 to 300 lines):

diff -r fbe11d104a69 -r 9d76d02cb249 external/cddl/osnet/dev/systrace/systrace.c
--- a/external/cddl/osnet/dev/systrace/systrace.c       Sun Jan 12 17:48:59 2014 +0000
+++ b/external/cddl/osnet/dev/systrace/systrace.c       Sun Jan 12 17:49:30 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: systrace.c,v 1.3 2011/07/17 20:54:33 joerg Exp $       */
+/*     $NetBSD: systrace.c,v 1.4 2014/01/12 17:49:30 riz Exp $ */
 
 /*
  * CDDL HEADER START
@@ -38,7 +38,9 @@
 #include <sys/cpuvar.h>
 #include <sys/fcntl.h>
 #include <sys/filio.h>
+#ifdef __FreeBSD__
 #include <sys/kdb.h>
+#endif
 #include <sys/kernel.h>
 #include <sys/kmem.h>
 #include <sys/kthread.h>
@@ -51,9 +53,12 @@
 #include <sys/poll.h>
 #include <sys/proc.h>
 #include <sys/selinfo.h>
+#ifdef __FreeBSD__
 #include <sys/smp.h>
 #include <sys/sysproto.h>
 #include <sys/sysent.h>
+#endif
+#include <sys/syscallargs.h>
 #include <sys/uio.h>
 #include <sys/unistd.h>
 
@@ -78,7 +83,7 @@
  */
 #include <sys/syscall.h>
 #include <kern/systrace_args.c>
-extern const char      *syscallnames[];
+extern const char      * const syscallnames[];
 #define        DEVNAME         "dtrace/systrace"
 #define        PROVNAME        "syscall"
 #define        MAXSYSCALL      SYS_MAXSYSCALL
@@ -98,15 +103,18 @@
 #error 1 << SYSTRACE_SHIFT must exceed number of system calls
 #endif
 
+#ifdef __FreeBSD__
 static d_open_t        systrace_open;
+#endif
 static int     systrace_unload(void);
 static void    systrace_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *);
-static void    systrace_provide(void *, dtrace_probedesc_t *);
+static void    systrace_provide(void *, const dtrace_probedesc_t *);
 static void    systrace_destroy(void *, dtrace_id_t, void *);
-static void    systrace_enable(void *, dtrace_id_t, void *);
+static int     systrace_enable(void *, dtrace_id_t, void *);
 static void    systrace_disable(void *, dtrace_id_t, void *);
 static void    systrace_load(void *);
 
+#ifdef __FreeBSD__
 static struct cdevsw systrace_cdevsw = {
        .d_version      = D_VERSION,
        .d_open         = systrace_open,
@@ -116,9 +124,10 @@
        .d_name         = "systrace",
 #endif
 };
+#endif
 
 static union   {
-       const char      **p_constnames;
+       const char      * const *p_constnames;
        char            **pp_syscallnames;
 } uglyhack = { SYSCALLNAMES };
 
@@ -143,7 +152,9 @@
        systrace_destroy
 };
 
+#ifdef __FreeBSD__
 static struct cdev             *systrace_cdev;
+#endif
 static dtrace_provider_id_t    systrace_id;
 
 #if !defined(LINUX_SYSTRACE)
@@ -155,21 +166,21 @@
  *       compat syscall from something like Linux.
  */
 static void
-systrace_probe(u_int32_t id, int sysnum, struct sysent *sysent, void *params)
+systrace_probe(u_int32_t id, int sysnum, struct sysent *se, void *params)
 {
        int             n_args  = 0;
-       u_int64_t       uargs[8];
+       union systrace_probe_args_un    uargs[SYS_MAXSYSARGS];
 
        /*
         * Check if this syscall has an argument conversion function
         * registered.
         */
-       if (sysent->sy_systrace_args_func != NULL)
+       if (se->sy_systrace_args_func != NULL)
                /*
                 * Convert the syscall parameters using the registered
                 * function.
                 */
-               (*sysent->sy_systrace_args_func)(sysnum, params, uargs, &n_args);
+               (*se->sy_systrace_args_func)(sysnum, params, uargs, &n_args);
        else
                /*
                 * Use the built-in system call argument conversion
@@ -180,7 +191,8 @@
                systrace_args(sysnum, params, uargs, &n_args);
 
        /* Process the probe using the converted argments. */
-       dtrace_probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4]);
+       dtrace_probe(id, uargs[0].u, uargs[1].u, uargs[2].u, uargs[3].u,
+               uargs[4].u);
 }
 #endif
 
@@ -199,7 +211,7 @@
 }
 
 static void
-systrace_provide(void *arg, dtrace_probedesc_t *desc)
+systrace_provide(void *arg, const dtrace_probedesc_t *desc)
 {
        int i;
 
@@ -238,7 +250,7 @@
 #endif
 }
 
-static void
+static int
 systrace_enable(void *arg, dtrace_id_t id, void *parg)
 {
        int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg);
@@ -250,6 +262,7 @@
                SYSENT[sysnum].sy_entry = id;
        else
                SYSENT[sysnum].sy_return = id;
+       return 0;
 }
 
 static void
@@ -264,16 +277,18 @@
 static void
 systrace_load(void *dummy)
 {
+#ifdef __FreeBSD__
        /* Create the /dev/dtrace/systrace entry. */
        systrace_cdev = make_dev(&systrace_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
           DEVNAME);
+#endif
 
        if (dtrace_register(PROVNAME, &systrace_attr, DTRACE_PRIV_USER,
            NULL, &systrace_pops, NULL, &systrace_id) != 0)
                return;
 
 #if !defined(LINUX_SYSTRACE)
-       systrace_probe_func = systrace_probe;
+       systrace_probe_func = (systrace_probe_func_t)systrace_probe;
 #endif
 }
 
@@ -290,11 +305,14 @@
        systrace_probe_func = NULL;
 #endif
 
+#ifdef __FreeBSD__
        destroy_dev(systrace_cdev);
+#endif
 
        return (error);
 }
 
+#ifdef __FreeBSD__
 static int
 systrace_modevent(module_t mod __unused, int type, void *data __unused)
 {
@@ -340,3 +358,27 @@
 MODULE_DEPEND(systrace, dtrace, 1, 1, 1);
 MODULE_DEPEND(systrace, opensolaris, 1, 1, 1);
 #endif
+#endif /* __FreeBSD__ */
+
+#ifdef __NetBSD__
+
+static int
+systrace_modcmd(modcmd_t cmd, void *data)
+{
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               systrace_load(NULL);
+               return 0;
+
+       case MODULE_CMD_FINI:
+               systrace_unload();
+               return 0;
+
+       default:
+               return ENOTTY;
+       }
+}
+
+MODULE(MODULE_CLASS_MISC, systrace, "dtrace");
+
+#endif
diff -r fbe11d104a69 -r 9d76d02cb249 external/cddl/osnet/dist/lib/libdtrace/common/dt_consume.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_consume.c        Sun Jan 12 17:48:59 2014 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_consume.c        Sun Jan 12 17:49:30 2014 +0000
@@ -868,9 +868,9 @@
 
                if (dtrace_lookup_by_addr(dtp, pc, &sym, &dts) == 0) {
                        if (pc > sym.st_value) {
-                               (void) snprintf(c, sizeof (c), "%s`%s+0x%llx",
-                                   dts.dts_object, dts.dts_name,
-                                   pc - sym.st_value);
+                               (void) snprintf(c, sizeof (c),
+                                   "%s`%s+0x%" PRIx64, dts.dts_object,
+                                   dts.dts_name, pc - sym.st_value);
                        } else {
                                (void) snprintf(c, sizeof (c), "%s`%s",
                                    dts.dts_object, dts.dts_name);
@@ -882,10 +882,11 @@
                         * interested in the containing module.
                         */
                        if (dtrace_lookup_by_addr(dtp, pc, NULL, &dts) == 0) {
-                               (void) snprintf(c, sizeof (c), "%s`0x%llx",
+                               (void) snprintf(c, sizeof (c), "%s`0x%" PRIx64,
                                    dts.dts_object, pc);
                        } else {
-                               (void) snprintf(c, sizeof (c), "0x%llx", pc);
+                               (void) snprintf(c, sizeof (c),
+                                   "0x%" PRIx64, pc);
                        }
                }
 
@@ -967,8 +968,8 @@
 
                        if (pc[i] > sym.st_value) {
                                (void) snprintf(c, sizeof (c),
-                                   "%s`%s+0x%llx", dt_basename(objname), name,
-                                   (u_longlong_t)(pc[i] - sym.st_value));
+                                   "%s`%s+0x%" PRIx64, dt_basename(objname),
+                                   name, (pc[i] - sym.st_value));
                        } else {
                                (void) snprintf(c, sizeof (c),
                                    "%s`%s", dt_basename(objname), name);
@@ -1001,11 +1002,11 @@
                        if (P != NULL && proc_objname(P, pc[i], objname,
 #endif
                            sizeof (objname)) != 0) {
-                               (void) snprintf(c, sizeof (c), "%s`0x%llx",
-                                   dt_basename(objname), (u_longlong_t)pc[i]);
+                               (void) snprintf(c, sizeof (c), "%s`0x%" PRIx64,
+                                   dt_basename(objname), pc[i]);
                        } else {
-                               (void) snprintf(c, sizeof (c), "0x%llx",
-                                   (u_longlong_t)pc[i]);
+                               (void) snprintf(c, sizeof (c), "0x%" PRIx64,
+                                   pc[i]);
                        }
                }
 
@@ -1133,7 +1134,7 @@
 #endif
                (void) snprintf(c, sizeof (c), "%s", dt_basename(objname));
        } else {
-               (void) snprintf(c, sizeof (c), "0x%llx", (u_longlong_t)pc);
+               (void) snprintf(c, sizeof (c), "0x%" PRIx64, pc);
        }
 
        err = dt_printf(dtp, fp, format, c);
@@ -1480,11 +1481,10 @@
                 * the containing module.
                 */
                if (dtrace_lookup_by_addr(dtp, pc, NULL, &dts) == 0) {
-                       (void) snprintf(c, sizeof (c), "%s`0x%llx",
-                           dts.dts_object, (u_longlong_t)pc);
+                       (void) snprintf(c, sizeof (c), "%s`0x%" PRIx64,
+                           dts.dts_object, pc);
                } else {
-                       (void) snprintf(c, sizeof (c), "0x%llx",
-                           (u_longlong_t)pc);
+                       (void) snprintf(c, sizeof (c), "0x%" PRIx64, pc);
                }
        }
 
@@ -1508,7 +1508,7 @@
        if (dtrace_lookup_by_addr(dtp, pc, NULL, &dts) == 0) {
                (void) snprintf(c, sizeof (c), "%s", dts.dts_object);
        } else {
-               (void) snprintf(c, sizeof (c), "0x%llx", (u_longlong_t)pc);
+               (void) snprintf(c, sizeof (c), "0x%" PRIx64, pc);
        }
 
        if (dt_printf(dtp, fp, format, c) < 0)
diff -r fbe11d104a69 -r 9d76d02cb249 external/cddl/osnet/dist/lib/libdtrace/common/dt_dis.c



Home | Main Index | Thread Index | Old Index