Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet/dist/uts/common/sys sync with FreeBSD



details:   https://anonhg.NetBSD.org/src/rev/e52703e651f9
branches:  trunk
changeset: 340666:e52703e651f9
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Sep 24 14:21:35 2015 +0000

description:
sync with FreeBSD

diffstat:

 external/cddl/osnet/dist/uts/common/sys/ctf_api.h     |   14 +-
 external/cddl/osnet/dist/uts/common/sys/dtrace.h      |  251 +++++++++++++----
 external/cddl/osnet/dist/uts/common/sys/dtrace_impl.h |   99 ++++--
 3 files changed, 266 insertions(+), 98 deletions(-)

diffs (truncated from 772 to 300 lines):

diff -r 6725bf1aa210 -r e52703e651f9 external/cddl/osnet/dist/uts/common/sys/ctf_api.h
--- a/external/cddl/osnet/dist/uts/common/sys/ctf_api.h Thu Sep 24 14:20:18 2015 +0000
+++ b/external/cddl/osnet/dist/uts/common/sys/ctf_api.h Thu Sep 24 14:21:35 2015 +0000
@@ -23,6 +23,9 @@
  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+/*
+ * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+ */
 
 /*
  * This header file defines the interfaces available from the CTF debugger
@@ -40,8 +43,6 @@
 #ifndef        _CTF_API_H
 #define        _CTF_API_H
 
-/* #pragma ident       "%Z%%M% %I%     %E% SMI" */
-
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/elf.h>
@@ -65,10 +66,10 @@
  * filling in ctf_sect_t structures and passing them to ctf_bufopen():
  */
 typedef struct ctf_sect {
-       char *cts_name;         /* section name (if any) */
+       const char *cts_name;   /* section name (if any) */
        ulong_t cts_type;       /* section type (ELF SHT_... value) */
        ulong_t cts_flags;      /* section flags (ELF SHF_... value) */
-#if defined(sun)
+#ifdef illumos
        const void *cts_data;   /* pointer to section data */
 #else
        void *cts_data;         /* pointer to section data */
@@ -154,6 +155,7 @@
 extern ctf_file_t *ctf_fdopen(int, int *);
 extern ctf_file_t *ctf_open(const char *, int *);
 extern ctf_file_t *ctf_create(int *);
+extern ctf_file_t *ctf_dup(ctf_file_t *);
 extern void ctf_close(ctf_file_t *);
 
 extern ctf_file_t *ctf_parent_file(ctf_file_t *);
@@ -179,6 +181,8 @@
 extern ctf_id_t ctf_type_resolve(ctf_file_t *, ctf_id_t);
 extern ssize_t ctf_type_lname(ctf_file_t *, ctf_id_t, char *, size_t);
 extern char *ctf_type_name(ctf_file_t *, ctf_id_t, char *, size_t);
+extern char *ctf_type_qname(ctf_file_t *, ctf_id_t, char *, size_t,
+    const char *);
 extern ssize_t ctf_type_size(ctf_file_t *, ctf_id_t);
 extern ssize_t ctf_type_align(ctf_file_t *, ctf_id_t);
 extern int ctf_type_kind(ctf_file_t *, ctf_id_t);
@@ -227,6 +231,8 @@
 
 extern int ctf_set_array(ctf_file_t *, ctf_id_t, const ctf_arinfo_t *);
 
+extern int ctf_delete_type(ctf_file_t *, ctf_id_t);
+
 extern int ctf_update(ctf_file_t *);
 extern int ctf_discard(ctf_file_t *);
 extern int ctf_write(ctf_file_t *, int);
diff -r 6725bf1aa210 -r e52703e651f9 external/cddl/osnet/dist/uts/common/sys/dtrace.h
--- a/external/cddl/osnet/dist/uts/common/sys/dtrace.h  Thu Sep 24 14:20:18 2015 +0000
+++ b/external/cddl/osnet/dist/uts/common/sys/dtrace.h  Thu Sep 24 14:21:35 2015 +0000
@@ -20,13 +20,20 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
+ */
+
 #ifndef _SYS_DTRACE_H
 #define        _SYS_DTRACE_H
 
+/* #pragma ident       "%Z%%M% %I%     %E% SMI" */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -47,22 +54,20 @@
 #include <sys/types.h>
 #include <sys/modctl.h>
 #include <sys/processor.h>
-#include <sys/proc.h>
-#if defined(sun)
+#ifdef illumos
 #include <sys/systm.h>
 #else
-#include <sys/pset.h>
+#include <sys/cpuvar.h>
 #include <sys/param.h>
 #include <sys/linker.h>
 #include <sys/ioccom.h>
 #include <sys/ucred.h>
+#include <sys/pset.h>
 typedef int model_t;
 #endif
 #include <sys/ctf_api.h>
-#if 0
+#ifdef illumos
 #include <sys/cyclic.h>
-#endif
-#if defined(sun)
 #include <sys/int_limits.h>
 #else
 #include <sys/stdint.h>
@@ -253,6 +258,10 @@
 #define        DIF_VAR_ERRNO           0x0120  /* thread errno */
 #define        DIF_VAR_EXECARGS        0x0121  /* process arguments */
 
+#ifndef illumos
+#define        DIF_VAR_CPU             0x0200
+#endif
+
 #define        DIF_SUBR_RAND                   0
 #define        DIF_SUBR_MUTEX_OWNED            1
 #define        DIF_SUBR_MUTEX_OWNER            2
@@ -297,13 +306,18 @@
 #define        DIF_SUBR_INET_NTOP              41
 #define        DIF_SUBR_INET_NTOA              42
 #define        DIF_SUBR_INET_NTOA6             43
-#define        DIF_SUBR_MEMREF                 44
-#define        DIF_SUBR_TYPEREF                45
-#define        DIF_SUBR_SX_SHARED_HELD         46
-#define        DIF_SUBR_SX_EXCLUSIVE_HELD      47
-#define        DIF_SUBR_SX_ISEXCLUSIVE         48
-
-#define        DIF_SUBR_MAX                    48      /* max subroutine value */
+#define        DIF_SUBR_TOUPPER                44
+#define        DIF_SUBR_TOLOWER                45
+#define        DIF_SUBR_MEMREF                 46
+#define        DIF_SUBR_TYPEREF                47
+#define        DIF_SUBR_SX_SHARED_HELD         48
+#define        DIF_SUBR_SX_EXCLUSIVE_HELD      49
+#define        DIF_SUBR_SX_ISEXCLUSIVE         50
+#define        DIF_SUBR_MEMSTR                 51
+#define        DIF_SUBR_GETF                   52
+#define        DIF_SUBR_JSON                   53
+#define        DIF_SUBR_STRTOLL                54
+#define        DIF_SUBR_MAX                    54      /* max subroutine value */
 
 typedef uint32_t dif_instr_t;
 
@@ -365,6 +379,7 @@
 #define        DIF_TYPE_STRING         1       /* type is a D string */
 
 #define        DIF_TF_BYREF            0x1     /* type is passed by reference */
+#define        DIF_TF_BYUREF           0x2     /* user type is passed by reference */
 
 /*
  * A DTrace Intermediate Format variable record is used to describe each of the
@@ -412,8 +427,10 @@
 #define        DTRACEACT_PRINTF                3       /* printf() action */
 #define        DTRACEACT_PRINTA                4       /* printa() action */
 #define        DTRACEACT_LIBACT                5       /* library-controlled action */
-#define        DTRACEACT_PRINTM                6       /* printm() action */
-#define        DTRACEACT_PRINTT                7       /* printt() action */
+#define        DTRACEACT_TRACEMEM              6       /* tracemem() action */
+#define        DTRACEACT_TRACEMEM_DYNSIZE      7       /* dynamic tracemem() size */
+#define        DTRACEACT_PRINTM                8       /* printm() action (BSD) */
+#define        DTRACEACT_PRINTT                9       /* printt() action (BSD) */
 
 #define        DTRACEACT_PROC                  0x0100
 #define        DTRACEACT_USTACK                (DTRACEACT_PROC + 1)
@@ -479,6 +496,7 @@
 #define        DTRACEAGG_STDDEV                (DTRACEACT_AGGREGATION + 6)
 #define        DTRACEAGG_QUANTIZE              (DTRACEACT_AGGREGATION + 7)
 #define        DTRACEAGG_LQUANTIZE             (DTRACEACT_AGGREGATION + 8)
+#define        DTRACEAGG_LLQUANTIZE            (DTRACEACT_AGGREGATION + 9)
 
 #define        DTRACEACT_ISAGG(x)              \
        (DTRACEACT_CLASS(x) == DTRACEACT_AGGREGATION)
@@ -513,6 +531,31 @@
        (int32_t)(((x) & DTRACE_LQUANTIZE_BASEMASK) >> \
        DTRACE_LQUANTIZE_BASESHIFT)
 
+#define        DTRACE_LLQUANTIZE_FACTORSHIFT           48
+#define        DTRACE_LLQUANTIZE_FACTORMASK            ((uint64_t)UINT16_MAX << 48)
+#define        DTRACE_LLQUANTIZE_LOWSHIFT              32
+#define        DTRACE_LLQUANTIZE_LOWMASK               ((uint64_t)UINT16_MAX << 32)
+#define        DTRACE_LLQUANTIZE_HIGHSHIFT             16
+#define        DTRACE_LLQUANTIZE_HIGHMASK              ((uint64_t)UINT16_MAX << 16)
+#define        DTRACE_LLQUANTIZE_NSTEPSHIFT            0
+#define        DTRACE_LLQUANTIZE_NSTEPMASK             UINT16_MAX
+
+#define        DTRACE_LLQUANTIZE_FACTOR(x)             \
+       (uint16_t)(((x) & DTRACE_LLQUANTIZE_FACTORMASK) >> \
+       DTRACE_LLQUANTIZE_FACTORSHIFT)
+
+#define        DTRACE_LLQUANTIZE_LOW(x)                \
+       (uint16_t)(((x) & DTRACE_LLQUANTIZE_LOWMASK) >> \
+       DTRACE_LLQUANTIZE_LOWSHIFT)
+
+#define        DTRACE_LLQUANTIZE_HIGH(x)               \
+       (uint16_t)(((x) & DTRACE_LLQUANTIZE_HIGHMASK) >> \
+       DTRACE_LLQUANTIZE_HIGHSHIFT)
+
+#define        DTRACE_LLQUANTIZE_NSTEP(x)              \
+       (uint16_t)(((x) & DTRACE_LLQUANTIZE_NSTEPMASK) >> \
+       DTRACE_LLQUANTIZE_NSTEPSHIFT)
+
 #define        DTRACE_USTACK_NFRAMES(x)        (uint32_t)((x) & UINT32_MAX)
 #define        DTRACE_USTACK_STRSIZE(x)        (uint32_t)((x) >> 32)
 #define        DTRACE_USTACK_ARG(x, y)         \
@@ -908,10 +951,10 @@
  * DTrace Metadata Description Structures
  *
  * DTrace separates the trace data stream from the metadata stream.  The only
- * metadata tokens placed in the data stream are enabled probe identifiers
- * (EPIDs) or (in the case of aggregations) aggregation identifiers.  In order
- * to determine the structure of the data, DTrace consumers pass the token to
- * the kernel, and receive in return a corresponding description of the enabled
+ * metadata tokens placed in the data stream are the dtrace_rechdr_t (EPID +
+ * timestamp) or (in the case of aggregations) aggregation identifiers.  To
+ * determine the structure of the data, DTrace consumers pass the token to the
+ * kernel, and receive in return a corresponding description of the enabled
  * probe (via the dtrace_eprobedesc structure) or the aggregation (via the
  * dtrace_aggdesc structure).  Both of these structures are expressed in terms
  * of record descriptions (via the dtrace_recdesc structure) that describe the
@@ -1006,7 +1049,12 @@
 #define        DTRACEOPT_AGGSORTREV    24      /* reverse-sort aggregations */
 #define        DTRACEOPT_AGGSORTPOS    25      /* agg. position to sort on */
 #define        DTRACEOPT_AGGSORTKEYPOS 26      /* agg. key position to sort on */
-#define        DTRACEOPT_MAX           27      /* number of options */
+#define        DTRACEOPT_TEMPORAL      27      /* temporally ordered output */
+#define        DTRACEOPT_AGGHIST       28      /* histogram aggregation output */
+#define        DTRACEOPT_AGGPACK       29      /* packed aggregation output */
+#define        DTRACEOPT_AGGZOOM       30      /* zoomed aggregation scaling */
+#define        DTRACEOPT_ZONE          31      /* zone in which to enable probes */
+#define        DTRACEOPT_MAX           32      /* number of options */
 
 #define        DTRACEOPT_UNSET         (dtrace_optval_t)-2     /* unset option */
 
@@ -1026,7 +1074,9 @@
  * where user-level wishes the kernel to snapshot the buffer to (the
  * dtbd_data field).  The kernel uses the same structure to pass back some
  * information regarding the buffer:  the size of data actually copied out, the
- * number of drops, the number of errors, and the offset of the oldest record.
+ * number of drops, the number of errors, the offset of the oldest record,
+ * and the time of the snapshot.
+ *
  * If the buffer policy is a "switch" policy, taking a snapshot of the
  * principal buffer has the additional effect of switching the active and
  * inactive buffers.  Taking a snapshot of the aggregation buffer _always_ has
@@ -1039,9 +1089,30 @@
        uint64_t dtbd_drops;                    /* number of drops */
        DTRACE_PTR(char, dtbd_data);            /* data */
        uint64_t dtbd_oldest;                   /* offset of oldest record */
+       uint64_t dtbd_timestamp;                /* hrtime of snapshot */
 } dtrace_bufdesc_t;
 
 /*
+ * Each record in the buffer (dtbd_data) begins with a header that includes
+ * the epid and a timestamp.  The timestamp is split into two 4-byte parts
+ * so that we do not require 8-byte alignment.
+ */
+typedef struct dtrace_rechdr {
+       dtrace_epid_t dtrh_epid;                /* enabled probe id */
+       uint32_t dtrh_timestamp_hi;             /* high bits of hrtime_t */
+       uint32_t dtrh_timestamp_lo;             /* low bits of hrtime_t */
+} dtrace_rechdr_t;
+
+#define        DTRACE_RECORD_LOAD_TIMESTAMP(dtrh)                      \
+       ((dtrh)->dtrh_timestamp_lo +                            \
+       ((uint64_t)(dtrh)->dtrh_timestamp_hi << 32))
+
+#define        DTRACE_RECORD_STORE_TIMESTAMP(dtrh, hrtime) {           \
+       (dtrh)->dtrh_timestamp_lo = (uint32_t)hrtime;           \
+       (dtrh)->dtrh_timestamp_hi = hrtime >> 32;               \
+}
+
+/*
  * DTrace Status
  *
  * The status of DTrace is relayed via the dtrace_status structure.  This
@@ -1207,7 +1278,7 @@
  * pseudodevice driver.  These ioctls comprise the user-kernel interface to
  * DTrace.
  */
-#if defined(sun)
+#ifdef illumos
 #define        DTRACEIOC               (('d' << 24) | ('t' << 16) | ('r' << 8))
 #define        DTRACEIOC_PROVIDER      (DTRACEIOC | 1)         /* provider query */
 #define        DTRACEIOC_PROBES        (DTRACEIOC | 2)         /* probe query */
@@ -1338,15 +1409,25 @@
  * helpers and should no longer be used.  No other ioctls are valid on the
  * helper minor node.
  */
+#ifdef illumos
 #define        DTRACEHIOC              (('d' << 24) | ('t' << 16) | ('h' << 8))
 #define        DTRACEHIOC_ADD          (DTRACEHIOC | 1)        /* add helper */
 #define        DTRACEHIOC_REMOVE       (DTRACEHIOC | 2)        /* remove helper */
 #define        DTRACEHIOC_ADDDOF       (DTRACEHIOC | 3)        /* add helper DOF */



Home | Main Index | Thread Index | Old Index