hook.c revision f4b3ec61df05330d25f55a36b975b4d7519fdeb1
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <mdb/mdb_modapi.h>
#include <sys/hook_impl.h>
#define MAX_LENGTH 64
/*
* List pfhooks hook list information.
*/
/*ARGSUSED*/
int
{
char hrstr[MAX_LENGTH];
if (argc)
return (DCMD_USAGE);
return (DCMD_ERR);
}
mdb_printf("%<u>%?s %10s %20s %?s%</u>\n",
"ADDR", "FLAG", "FUNC", "NAME");
while (hlp) {
mdb_warn("couldn't read hook list at %p",
hlp);
return (DCMD_ERR);
}
mdb_warn("hook list at %p has null role",
return (DCMD_ERR);
}
mdb_warn("couldn't read list role at %p",
return (DCMD_ERR);
}
mdb_printf("%0?p %10x %0?p %10s\n",
else
mdb_printf("%0?p %10x %20s %10s\n",
}
return (DCMD_OK);
}
/*
* List pfhooks event information.
* List the hooks information in verbose mode as well.
*/
/*ARGSUSED*/
int
{
char hprstr[MAX_LENGTH];
if (argc)
return (DCMD_USAGE);
return (DCMD_ERR);
}
while (hrp) {
return (DCMD_ERR);
}
mdb_warn("hook register at %p has no hook provider",
hrp);
return (DCMD_ERR);
}
mdb_warn("hook provider at %p has null role",
return (DCMD_ERR);
}
mdb_warn("hook provider at %p has null role",
return (DCMD_ERR);
}
mdb_warn("couldn't read provider role at %p",
return (DCMD_ERR);
}
}
return (DCMD_OK);
}
/*
* List pfhooks family information.
*/
/*ARGSUSED*/
int
{
struct hook_stack *hks;
char hrrstr[MAX_LENGTH];
if (argc)
return (DCMD_USAGE);
mdb_warn("couldn't read netstack_hook");
return (DCMD_ERR);
}
mdb_warn("couldn't read hook family head");
return (DCMD_ERR);
}
while (hfp) {
return (DCMD_ERR);
}
mdb_warn("hook root at %p has null role",
hf.hfi_family);
return (DCMD_ERR);
}
mdb_warn("couldn't read root role at %p",
return (DCMD_ERR);
}
}
return (DCMD_OK);
}
static int
{
mdb_warn("global walk not supported\n");
return (WALK_ERR);
}
return (DCMD_ERR);
}
wsp->walk_cbdata));
}
static int
{
return (DCMD_ERR);
}
return (WALK_DONE);
wsp->walk_cbdata));
}
static const mdb_dcmd_t dcmds[] = {
{ "hookeventlist", "", "display hook event information",
hookeventlist, NULL },
{ NULL }
};
static const mdb_walker_t walkers[] = {
{ "hookevent_stack", "walk list of hooks",
{ NULL }
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}