[talk] I declare not so stupid unix tricks thread open

Fabian Keil freebsd-listen at fabiankeil.de
Sat Mar 15 09:38:23 EDT 2014


Marc Spitzer <mspitzer at gmail.com> wrote:

> We need to share our not so stupid unix tricks.  Here is one:

Here's another one (and I demand extra points because even the name is
stupid and misleading):

explain_type() {
    local type="$1"

    if [ -z "${type}" ]; then
        echo "No type given, dude"
        return 1
    fi

    sudo dtrace -qn 'BEGIN {p=('"${type}"'*)alloca(sizeof('"${type}"')); print(*p);exit(0)}'
}

fk at r500 ~ $explain_type "struct g_geom"
struct g_geom {
    char *name = 0
    struct g_class *class = 0
    struct geom = {
        struct g_geom *le_next = 0
        struct g_geom **le_prev = 0
    }
    struct consumer = {
        struct g_consumer *lh_first = 0
    }
    struct provider = {
        struct g_provider *lh_first = 0
    }
    struct geoms = {
        struct g_geom *tqe_next = 0
        struct g_geom **tqe_prev = 0
    }
    int rank = 0
    g_start_t *start = 0
    g_spoiled_t *spoiled = 0
    g_attrchanged_t *attrchanged = 0
    g_dumpconf_t *dumpconf = 0
    g_access_t *access = 0
    g_orphan_t *orphan = 0
    g_ioctl_t *ioctl = 0
    g_provgone_t *providergone = 0
    g_resize_t *resize = 0
    void *spare0 = 0
    void *spare1 = 0
    void *softc = 0
    unsigned int flags = 0
}

BTW, is NYCBUG interested in supporting a protest weekend against mass
surveillance on April 12th in Cologne, Germany?
http://cologne.stopwatchingus.info/demo-12-april/en.html

There may even be a DTrace (and thus BSD) connection:
http://www.listbox.com/member/archive/184261/2014/03/sort/time_rev/page/1/entry/0:16/20140314025218:46D0A7E8-AB45-11E3-AE09-FF17A2C259A7/

Please don't book your flights prematurely, though ...

Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.nycbug.org/pipermail/talk/attachments/20140315/b93edb2f/attachment.bin>


More information about the talk mailing list