Print this page
4477 DTrace should speak JSON
Reviewed by: Bryan Cantrill <bmc@joyent.com>


 272 #define DIF_SUBR_CLEANPATH              27
 273 #define DIF_SUBR_STRCHR                 28
 274 #define DIF_SUBR_STRRCHR                29
 275 #define DIF_SUBR_STRSTR                 30
 276 #define DIF_SUBR_STRTOK                 31
 277 #define DIF_SUBR_SUBSTR                 32
 278 #define DIF_SUBR_INDEX                  33
 279 #define DIF_SUBR_RINDEX                 34
 280 #define DIF_SUBR_HTONS                  35
 281 #define DIF_SUBR_HTONL                  36
 282 #define DIF_SUBR_HTONLL                 37
 283 #define DIF_SUBR_NTOHS                  38
 284 #define DIF_SUBR_NTOHL                  39
 285 #define DIF_SUBR_NTOHLL                 40
 286 #define DIF_SUBR_INET_NTOP              41
 287 #define DIF_SUBR_INET_NTOA              42
 288 #define DIF_SUBR_INET_NTOA6             43
 289 #define DIF_SUBR_TOUPPER                44
 290 #define DIF_SUBR_TOLOWER                45
 291 #define DIF_SUBR_GETF                   46


 292 
 293 #define DIF_SUBR_MAX                    46      /* max subroutine value */
 294 
 295 typedef uint32_t dif_instr_t;
 296 
 297 #define DIF_INSTR_OP(i)                 (((i) >> 24) & 0xff)
 298 #define DIF_INSTR_R1(i)                 (((i) >> 16) & 0xff)
 299 #define DIF_INSTR_R2(i)                 (((i) >>  8) & 0xff)
 300 #define DIF_INSTR_RD(i)                 ((i) & 0xff)
 301 #define DIF_INSTR_RS(i)                 ((i) & 0xff)
 302 #define DIF_INSTR_LABEL(i)              ((i) & 0xffffff)
 303 #define DIF_INSTR_VAR(i)                (((i) >>  8) & 0xffff)
 304 #define DIF_INSTR_INTEGER(i)            (((i) >>  8) & 0xffff)
 305 #define DIF_INSTR_STRING(i)             (((i) >>  8) & 0xffff)
 306 #define DIF_INSTR_SUBR(i)               (((i) >>  8) & 0xffff)
 307 #define DIF_INSTR_TYPE(i)               (((i) >> 16) & 0xff)
 308 #define DIF_INSTR_XLREF(i)              (((i) >>  8) & 0xffff)
 309 
 310 #define DIF_INSTR_FMT(op, r1, r2, d) \
 311         (((op) << 24) | ((r1) << 16) | ((r2) << 8) | (d))
 312 
 313 #define DIF_INSTR_NOT(r1, d)            (DIF_INSTR_FMT(DIF_OP_NOT, r1, 0, d))




 272 #define DIF_SUBR_CLEANPATH              27
 273 #define DIF_SUBR_STRCHR                 28
 274 #define DIF_SUBR_STRRCHR                29
 275 #define DIF_SUBR_STRSTR                 30
 276 #define DIF_SUBR_STRTOK                 31
 277 #define DIF_SUBR_SUBSTR                 32
 278 #define DIF_SUBR_INDEX                  33
 279 #define DIF_SUBR_RINDEX                 34
 280 #define DIF_SUBR_HTONS                  35
 281 #define DIF_SUBR_HTONL                  36
 282 #define DIF_SUBR_HTONLL                 37
 283 #define DIF_SUBR_NTOHS                  38
 284 #define DIF_SUBR_NTOHL                  39
 285 #define DIF_SUBR_NTOHLL                 40
 286 #define DIF_SUBR_INET_NTOP              41
 287 #define DIF_SUBR_INET_NTOA              42
 288 #define DIF_SUBR_INET_NTOA6             43
 289 #define DIF_SUBR_TOUPPER                44
 290 #define DIF_SUBR_TOLOWER                45
 291 #define DIF_SUBR_GETF                   46
 292 #define DIF_SUBR_JSON                   47
 293 #define DIF_SUBR_STRTOLL                48
 294 
 295 #define DIF_SUBR_MAX                    48      /* max subroutine value */
 296 
 297 typedef uint32_t dif_instr_t;
 298 
 299 #define DIF_INSTR_OP(i)                 (((i) >> 24) & 0xff)
 300 #define DIF_INSTR_R1(i)                 (((i) >> 16) & 0xff)
 301 #define DIF_INSTR_R2(i)                 (((i) >>  8) & 0xff)
 302 #define DIF_INSTR_RD(i)                 ((i) & 0xff)
 303 #define DIF_INSTR_RS(i)                 ((i) & 0xff)
 304 #define DIF_INSTR_LABEL(i)              ((i) & 0xffffff)
 305 #define DIF_INSTR_VAR(i)                (((i) >>  8) & 0xffff)
 306 #define DIF_INSTR_INTEGER(i)            (((i) >>  8) & 0xffff)
 307 #define DIF_INSTR_STRING(i)             (((i) >>  8) & 0xffff)
 308 #define DIF_INSTR_SUBR(i)               (((i) >>  8) & 0xffff)
 309 #define DIF_INSTR_TYPE(i)               (((i) >> 16) & 0xff)
 310 #define DIF_INSTR_XLREF(i)              (((i) >>  8) & 0xffff)
 311 
 312 #define DIF_INSTR_FMT(op, r1, r2, d) \
 313         (((op) << 24) | ((r1) << 16) | ((r2) << 8) | (d))
 314 
 315 #define DIF_INSTR_NOT(r1, d)            (DIF_INSTR_FMT(DIF_OP_NOT, r1, 0, d))