diff options
Diffstat (limited to 'lib/libdtrace/common/dt_cc.c')
| -rw-r--r-- | lib/libdtrace/common/dt_cc.c | 102 |
1 files changed, 2 insertions, 100 deletions
diff --git a/lib/libdtrace/common/dt_cc.c b/lib/libdtrace/common/dt_cc.c index 8bd09151d1c4..64b29220491e 100644 --- a/lib/libdtrace/common/dt_cc.c +++ b/lib/libdtrace/common/dt_cc.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -87,7 +87,6 @@ #include <sys/wait.h> #include <assert.h> -#include <string.h> #include <strings.h> #include <signal.h> #include <unistd.h> @@ -949,77 +948,6 @@ dt_action_speculate(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) } static void -dt_action_printm(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) -{ - dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp); - - dt_node_t *size = dnp->dn_args; - dt_node_t *addr = dnp->dn_args->dn_list; - - char n[DT_TYPE_NAMELEN]; - - if (dt_node_is_posconst(size) == 0) { - dnerror(size, D_PRINTM_SIZE, "printm( ) argument #1 must " - "be a non-zero positive integral constant expression\n"); - } - - if (dt_node_is_pointer(addr) == 0) { - dnerror(addr, D_PRINTM_ADDR, - "printm( ) argument #2 is incompatible with " - "prototype:\n\tprototype: pointer\n" - "\t argument: %s\n", - dt_node_type_name(addr, n, sizeof (n))); - } - - dt_cg(yypcb, addr); - ap->dtad_difo = dt_as(yypcb); - ap->dtad_kind = DTRACEACT_PRINTM; - - ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF; - ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + sizeof(uintptr_t); -} - -static void -dt_action_printt(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) -{ - dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp); - - dt_node_t *size = dnp->dn_args; - dt_node_t *addr = dnp->dn_args->dn_list; - - char n[DT_TYPE_NAMELEN]; - - if (dt_node_is_posconst(size) == 0) { - dnerror(size, D_PRINTT_SIZE, "printt( ) argument #1 must " - "be a non-zero positive integral constant expression\n"); - } - - if (addr == NULL || addr->dn_kind != DT_NODE_FUNC || - addr->dn_ident != dt_idhash_lookup(dtp->dt_globals, "typeref")) { - dnerror(addr, D_PRINTT_ADDR, - "printt( ) argument #2 is incompatible with " - "prototype:\n\tprototype: typeref()\n" - "\t argument: %s\n", - dt_node_type_name(addr, n, sizeof (n))); - } - - dt_cg(yypcb, addr); - ap->dtad_difo = dt_as(yypcb); - ap->dtad_kind = DTRACEACT_PRINTT; - - ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF; - - /* - * Allow additional buffer space for the data size, type size, - * type string length and a stab in the dark (32 bytes) for the - * type string. The type string is part of the typeref() that - * this action references. - */ - ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + 3 * sizeof(uintptr_t) + 32; - -} - -static void dt_action_commit(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) { dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp); @@ -1085,12 +1013,6 @@ dt_compile_fun(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) case DT_ACT_PRINTF: dt_action_printflike(dtp, dnp->dn_expr, sdp, DTRACEACT_PRINTF); break; - case DT_ACT_PRINTM: - dt_action_printm(dtp, dnp->dn_expr, sdp); - break; - case DT_ACT_PRINTT: - dt_action_printt(dtp, dnp->dn_expr, sdp); - break; case DT_ACT_RAISE: dt_action_raise(dtp, dnp->dn_expr, sdp); break; @@ -1667,9 +1589,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) char **argv = malloc(sizeof (char *) * (argc + 5)); FILE *ofp = tmpfile(); -#if defined(sun) char ipath[20], opath[20]; /* big enough for /dev/fd/ + INT_MAX + \0 */ -#endif char verdef[32]; /* big enough for -D__SUNW_D_VERSION=0x%08x + \0 */ struct sigaction act, oact; @@ -1677,11 +1597,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) int wstat, estat; pid_t pid; -#if defined(sun) off64_t off; -#else - off_t off = 0; -#endif int c; if (argv == NULL || ofp == NULL) { @@ -1708,10 +1624,8 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) (void) fseeko64(ifp, off, SEEK_SET); } -#if defined(sun) (void) snprintf(ipath, sizeof (ipath), "/dev/fd/%d", fileno(ifp)); (void) snprintf(opath, sizeof (opath), "/dev/fd/%d", fileno(ofp)); -#endif bcopy(dtp->dt_cpp_argv, argv, sizeof (char *) * argc); @@ -1719,7 +1633,6 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) "-D__SUNW_D_VERSION=0x%08x", dtp->dt_vmax); argv[argc++] = verdef; -#if defined(sun) switch (dtp->dt_stdcmode) { case DT_STDC_XA: case DT_STDC_XT: @@ -1732,9 +1645,6 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) argv[argc++] = ipath; argv[argc++] = opath; -#else - argv[argc++] = "-P"; -#endif argv[argc] = NULL; /* @@ -1761,12 +1671,6 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp) } if (pid == 0) { -#if !defined(sun) - if (isatty(fileno(ifp)) == 0) - lseek(fileno(ifp), off, SEEK_SET); - dup2(fileno(ifp), 0); - dup2(fileno(ofp), 1); -#endif (void) execvp(dtp->dt_cpp_path, argv); _exit(errno == ENOENT ? 127 : 126); } @@ -2106,10 +2010,8 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path) dt_dprintf("skipping library %s: %s\n", dld->dtld_library, dtrace_errmsg(dtp, dtrace_errno(dtp))); - } else { - dld->dtld_loaded = B_TRUE; + } else dt_program_destroy(dtp, pgp); - } } dt_lib_depend_free(dtp); |
