MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_sysctl

Function db_sysctl

freebsd/kern/kern_sysctl.c:2677–2716  ·  view source on GitHub ↗

* Run a sysctl handler with the DDB oldfunc and newfunc attached. * Instead of copying any output to a buffer we'll dump it right to * the console. */

Source from the content-addressed store, hash-verified

2675 * the console.
2676 */
2677static int
2678db_sysctl(struct sysctl_oid *oidp, int *name, u_int namelen,
2679 void *old, size_t *oldlenp, size_t *retval, int flags)
2680{
2681 struct sysctl_req req;
2682 int error;
2683
2684 /* Setup the request */
2685 bzero(&req, sizeof req);
2686 req.td = kdb_thread;
2687 req.oldfunc = sysctl_old_ddb;
2688 req.newfunc = sysctl_new_ddb;
2689 req.lock = REQ_UNWIRED;
2690 if (oldlenp) {
2691 req.oldlen = *oldlenp;
2692 }
2693 req.validlen = req.oldlen;
2694 if (old) {
2695 req.oldptr = old;
2696 }
2697
2698 /* Setup our globals for sysctl_old_ddb */
2699 g_ddb_oid = oidp;
2700 g_ddb_sysctl_flags = flags;
2701 g_ddb_sysctl_printed = 0;
2702
2703 error = sysctl_root(0, name, namelen, &req);
2704
2705 /* Reset globals */
2706 g_ddb_oid = NULL;
2707 g_ddb_sysctl_flags = 0;
2708
2709 if (retval) {
2710 if (req.oldptr && req.oldidx > req.validlen)
2711 *retval = req.validlen;
2712 else
2713 *retval = req.oldidx;
2714 }
2715 return (error);
2716}
2717
2718/*
2719 * Show a sysctl's name

Callers 2

db_show_oid_nameFunction · 0.85
db_show_oidFunction · 0.85

Calls 2

bzeroFunction · 0.85
sysctl_rootFunction · 0.85

Tested by

no test coverage detected