[DTrace-devel] [PATCH v2] Add support for inet_ntop() subroutine
Kris Van Hees
kris.van.hees at oracle.com
Thu Sep 14 23:23:42 UTC 2023
On Thu, Sep 14, 2023 at 06:44:30PM -0400, Eugene Loh via DTrace-devel wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> I confess I don't really understand this stuff but oh well.
It is manual construction of a node tree, cooking it (finalizing it), and
then having the code generator having its way with it. So, I am essentially
performing a code transformation on the fly.
> Also, test/unittest/funcs/tst.inet_ntop.d fails. Should the .r file be
> changed so that the AF_INET6 cases with embedded IPV4 no longer have IPv6
> prefixes?
Yes and no. I plan to post a patch later today to implement the proper prefix
handling for IPv4 in inet_ntop vs inet_ntoa6.
> And...
>
> On 9/14/23 15:56, Eugene Loh via DTrace-devel wrote:
> > diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> > +static void
> > +dt_cg_subr_inet_ntop(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
> > +{
> > + dt_node_t *af = dnp->dn_args;
> > + dt_node_t *addr = af->dn_list;
> > + dt_node_t *tnp, *cnp, *lnp, *rnp, *anp, *xnp;;
>
> s/;;/;/
Thanks.
> > [...]
> > + xnp = dt_node_type(ddp); /* frees ddp */
> > + /* Create a node to represent: (type)addr */
> > + xnp = dt_node_op2(DT_TOK_LPAR, xnp, addr);
> > [...]
> > + xnp = dt_node_type(ddp); /* frees ddp */
> > +
> > + xnp = dt_node_op2(DT_TOK_LPAR, xnp, addr); /* (type)addr */
>
> Might as well make those two sections of code as boringly similar as
> possible, comments and all.
Oops, meant to do that. Thanks.
More information about the DTrace-devel
mailing list