Example #1
0
static void
fujitsu_hk_sysctl_setup(struct fujitsu_hk_softc *sc)
{
    const struct sysctlnode *rnode;
    bool dummy_state;

    if (fujitsu_hk_get_backlight(sc, &dummy_state) == 0) {
        if ((sysctl_createv(&sc->sc_log, 0, NULL, &rnode,
                            0, CTLTYPE_NODE, "acpi", NULL,
                            NULL, 0, NULL, 0,
                            CTL_HW, CTL_CREATE, CTL_EOL)) != 0)
            goto fail;

        if ((sysctl_createv(&sc->sc_log, 0, &rnode, &rnode,
                            0, CTLTYPE_NODE, device_xname(sc->sc_dev),
                            SYSCTL_DESCR("Fujitsu hotkeys controls"),
                            NULL, 0, NULL, 0,
                            CTL_CREATE, CTL_EOL)) != 0)
            goto fail;

        (void)sysctl_createv(&sc->sc_log, 0, &rnode, NULL,
                             CTLFLAG_READWRITE, CTLTYPE_BOOL, "backlight",
                             SYSCTL_DESCR("Internal DFP backlight switch state"),
                             fujitsu_hk_sysctl_backlight, 0, (void *)sc, 0,
                             CTL_CREATE, CTL_EOL);
    }

    return;

fail:
    aprint_error_dev(sc->sc_dev, "couldn't add sysctl nodes\n");
}
Example #2
0
static void
sysctl_wmi_hp_setup(struct wmi_hp_softc *sc)
{
	const struct sysctlnode *rnode;
	int err;

	err = sysctl_createv(&wmihp_sysctllog, 0, NULL, &rnode,
	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "acpi", NULL,
	    NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL);

	if (err != 0)
		return;

	err = sysctl_createv(&wmihp_sysctllog, 0, &rnode, &rnode,
	    0, CTLTYPE_NODE, "wmi", SYSCTL_DESCR("ACPI HP WMI"),
	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);

	if (err != 0)
		return;

	if (wmi_hp_method_read(sc, WMI_HP_METHOD_CMD_ALS) == true) {
		(void)sysctl_createv(NULL, 0, &rnode, NULL,
		    CTLFLAG_READWRITE, CTLTYPE_BOOL, "als",
		    SYSCTL_DESCR("Ambient Light Sensor"),
		    sysctl_wmi_hp_set_als, 0, NULL, 0, CTL_CREATE, CTL_EOL);
	}
}
Example #3
0
void
gpiopwm_attach(device_t parent, device_t self, void *aux)
{
	struct gpiopwm_softc *sc = device_private(self);
	struct gpio_attach_args *ga = aux;
	const struct sysctlnode *node;

	sc->sc_dev = self;

	/* Map pin */
	sc->sc_gpio = ga->ga_gpio;
	sc->sc_map.pm_map = sc->_map;
	if (gpio_pin_map(sc->sc_gpio, ga->ga_offset, ga->ga_mask,
	    &sc->sc_map)) {
		aprint_error(": can't map pin\n");
		return;
	}
	aprint_normal(" [%d]", sc->sc_map.pm_map[0]);
	pmf_device_register(self, NULL, NULL);

	callout_init(&sc->sc_pulse, CALLOUT_MPSAFE);
	callout_setfunc(&sc->sc_pulse, gpiopwm_pulse, sc);

        sysctl_createv(&sc->sc_log, 0, NULL, &node,
            0,
            CTLTYPE_NODE, device_xname(sc->sc_dev),
            SYSCTL_DESCR("GPIO software PWM"),
            NULL, 0, NULL, 0,
            CTL_HW, CTL_CREATE, CTL_EOL);

        if (node == NULL) {
		printf(": can't create sysctl node\n");
                return;
	}

        sysctl_createv(&sc->sc_log, 0, &node, NULL,
            CTLFLAG_READWRITE,
            CTLTYPE_INT, "on",
            SYSCTL_DESCR("PWM 'on' period in ticks"),
            gpiopwm_set_on, 0, (void *)sc, 0,
	    CTL_CREATE, CTL_EOL);
        sysctl_createv(&sc->sc_log, 0, &node, NULL,
            CTLFLAG_READWRITE,
            CTLTYPE_INT, "off",
            SYSCTL_DESCR("PWM 'off' period in ticks"),
            gpiopwm_set_off, 0, (void *)sc, 0,
	    CTL_CREATE, CTL_EOL);

	aprint_normal("\n");
	return;
}
static void
acpicpu_sysctl(device_t self)
{
	const struct sysctlnode *node;
	int err;

	KASSERT(acpicpu_log == NULL);

	err = sysctl_createv(&acpicpu_log, 0, NULL, &node,
	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,
	    NULL, 0, NULL, 0, CTL_HW, CTL_EOL);

	if (err != 0)
		goto fail;

	err = sysctl_createv(&acpicpu_log, 0, &node, &node,
	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "acpi", NULL,
	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);

	if (err != 0)
		goto fail;

	err = sysctl_createv(&acpicpu_log, 0, &node, &node,
	    0, CTLTYPE_NODE, "cpu", SYSCTL_DESCR("ACPI CPU"),
	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);

	if (err != 0)
		goto fail;

	err = sysctl_createv(&acpicpu_log, 0, &node, NULL,
	    CTLFLAG_READWRITE, CTLTYPE_BOOL, "dynamic",
	    SYSCTL_DESCR("Dynamic states"), NULL, 0,
	    &acpicpu_dynamic, 0, CTL_CREATE, CTL_EOL);

	if (err != 0)
		goto fail;

	err = sysctl_createv(&acpicpu_log, 0, &node, NULL,
	    CTLFLAG_READWRITE, CTLTYPE_BOOL, "passive",
	    SYSCTL_DESCR("Passive cooling"), NULL, 0,
	    &acpicpu_passive, 0, CTL_CREATE, CTL_EOL);

	if (err != 0)
		goto fail;

	return;

fail:
	aprint_error_dev(self, "failed to initialize sysctl (err %d)\n", err);
}
Example #5
0
static void
obsled_attach(device_t parent, device_t self, void *aux)
{
        struct obsled_softc *sc = device_private(self);
        struct gpio_attach_args *ga = aux;
	struct sysctlnode *node;
	int err, node_mib;
	char led_name[5];
	/* int led = (1 << device_unit(sc->sc_dev)); */

	snprintf(led_name, sizeof(led_name),
		"led%d", (1 << device_unit(sc->sc_dev)) & 0x7);
        aprint_naive(": OpenBlockS %s\n", led_name);
        aprint_normal(": OpenBlockS %s\n", led_name);

	sc->sc_dev = self;
        sc->sc_tag = ga->ga_tag;
        sc->sc_addr = ga->ga_addr;
	sc->sc_led_state = 0;

	obs266_led_set(OBS266_LED_OFF);

	/* add sysctl interface */
	err = sysctl_createv(NULL, 0,
			NULL, NULL,
			0, CTLTYPE_NODE,
			"hw",
			NULL,
			NULL, 0, NULL, 0,
			CTL_HW, CTL_EOL);
	if (err != 0)
		return;
	err = sysctl_createv(NULL, 0,
			NULL, (const struct sysctlnode **)&node,
			0, CTLTYPE_NODE,
			"obsled",
			NULL,
			NULL, 0, NULL, 0,
			CTL_HW, CTL_CREATE, CTL_EOL);
	if (err  != 0)
		return;
	node_mib = node->sysctl_num;
	err = sysctl_createv(NULL, 0,
			NULL, (const struct sysctlnode **)&node,
			CTLFLAG_READWRITE, CTLTYPE_INT,
			led_name,
			SYSCTL_DESCR("OpenBlockS LED state (0=off, 1=on)"),
			obsled_sysctl_verify, 0, (void *)sc, 0,
			CTL_HW, node_mib, CTL_CREATE, CTL_EOL);
	if (err  != 0)
		return;

	sc->sc_led_state_mib = node->sysctl_num;
#if 0
	{
		gpio_tag_t tag = sc->sc_tag;
	 	(*(tag)->io_or_write)((tag)->cookie, sc->sc_addr, 0);
	}
#endif
}
Example #6
0
static int
overlay_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&overlay_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&overlay_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT, CTLTYPE_NODE, "overlay",
			       SYSCTL_DESCR("Overlay file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_CREATE, CTL_EOL);
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&overlay_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&overlay_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
Example #7
0
static int
union_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&union_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&union_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "union",
			       SYSCTL_DESCR("Union file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, 15, CTL_EOL);
		/*
		 * XXX the "15" above could be dynamic, thereby eliminating
		 * one more instance of the "number to vfs" mapping problem,
		 * but "15" is the order as taken from sys/mount.h
		 */
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&union_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&union_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
Example #8
0
/*
 * Initialize clock frequencies and start both clocks running.
 */
void
initclocks(void)
{
	static struct sysctllog *clog;
	int i;

	/*
	 * Set divisors to 1 (normal case) and let the machine-specific
	 * code do its bit.
	 */
	psdiv = 1;
	/*
	 * provide minimum default time counter
	 * will only run at interrupt resolution
	 */
	intr_timecounter.tc_frequency = hz;
	tc_init(&intr_timecounter);
	cpu_initclocks();

	/*
	 * Compute profhz and stathz, fix profhz if needed.
	 */
	i = stathz ? stathz : hz;
	if (profhz == 0)
		profhz = i;
	psratio = profhz / i;
	if (schedhz == 0) {
		/* 16Hz is best */
		hardscheddiv = hz / 16;
		if (hardscheddiv <= 0)
			panic("hardscheddiv");
	}

	sysctl_createv(&clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_STRUCT, "clockrate",
		       SYSCTL_DESCR("Kernel clock rates"),
		       sysctl_kern_clockrate, 0, NULL,
		       sizeof(struct clockinfo),
		       CTL_KERN, KERN_CLOCKRATE, CTL_EOL);
	sysctl_createv(&clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_INT, "hardclock_ticks",
		       SYSCTL_DESCR("Number of hardclock ticks"),
		       NULL, 0, &hardclock_ticks, sizeof(hardclock_ticks),
		       CTL_KERN, KERN_HARDCLOCK_TICKS, CTL_EOL);
}
static void
sysctl_vfs_syncfs_setup(struct sysctllog **clog)
{
	const struct sysctlnode *rnode, *cnode;

	sysctl_createv(clog, 0, NULL, &rnode,
			CTLFLAG_PERMANENT,
			CTLTYPE_NODE, "vfs", NULL,
			NULL, 0, NULL, 0,
			CTL_VFS, CTL_EOL);

	sysctl_createv(clog, 0, &rnode, &rnode,
			CTLFLAG_PERMANENT,
			CTLTYPE_NODE, "sync",
			SYSCTL_DESCR("syncer options"),
			NULL, 0, NULL, 0,
			CTL_CREATE, CTL_EOL);

	sysctl_createv(clog, 0, &rnode, &cnode,
			CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
			CTLTYPE_QUAD, "delay",
			SYSCTL_DESCR("max time to delay syncing data"),
			NULL, 0, &syncdelay, 0,
			CTL_CREATE, CTL_EOL);

	sysctl_createv(clog, 0, &rnode, &cnode,
			CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
			CTLTYPE_QUAD, "filedelay",
			SYSCTL_DESCR("time to delay syncing files"),
			NULL, 0, &filedelay, 0,
			CTL_CREATE, CTL_EOL);

	sysctl_createv(clog, 0, &rnode, &cnode,
			CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
			CTLTYPE_QUAD, "dirdelay",
			SYSCTL_DESCR("time to delay syncing directories"),
			NULL, 0, &dirdelay, 0,
			CTL_CREATE, CTL_EOL);

	sysctl_createv(clog, 0, &rnode, &cnode,
			CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
			CTLTYPE_QUAD, "metadelay",
			SYSCTL_DESCR("time to delay syncing metadata"),
			NULL, 0, &metadelay, 0,
			CTL_CREATE, CTL_EOL);
}
Example #10
0
static int
smbfs_modcmd(modcmd_t cmd, void *arg)
{
	const struct sysctlnode *smb = NULL;
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&smbfs_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&smbfs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "vfs", NULL,
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_EOL);
		sysctl_createv(&smbfs_sysctl_log, 0, NULL, &smb,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "samba",
			       SYSCTL_DESCR("SMB/CIFS remote file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_CREATE, CTL_EOL);

		if (smb != NULL) {
			sysctl_createv(&smbfs_sysctl_log, 0, &smb, NULL,
				       CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
				       CTLTYPE_INT, "version",
				       SYSCTL_DESCR("smbfs version"),
				       NULL, SMBFS_VERSION, NULL, 0,
				       CTL_CREATE, CTL_EOL);
		}
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&smbfs_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&smbfs_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
/*
 * Setup sysctl(3) MIB, net.ieee80211.*
 *
 * TBD condition CTLFLAG_PERMANENT on being a module or not
 */
void
ieee80211_rssadapt_sysctl_setup(struct sysctllog **clog)
{
	int rc;
	const struct sysctlnode *node;

	if ((rc = sysctl_createv(clog, 0, NULL, &node,
	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "link", NULL,
	    NULL, 0, NULL, 0, CTL_NET, PF_LINK, CTL_EOL)) != 0)
		goto err;

	if ((rc = sysctl_createv(clog, 0, &node, &node,
	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "ieee80211", NULL,
	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0)
		goto err;

	if ((rc = sysctl_createv(clog, 0, &node, &node,
	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "rssadapt",
	    SYSCTL_DESCR("Received Signal Strength adaptation controls"),
	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0)
		goto err;

#ifdef IEEE80211_DEBUG
	/* control debugging printfs */
	if ((rc = sysctl_createv(clog, 0, &node, NULL,
	    CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, "debug",
	    SYSCTL_DESCR("Enable RSS adaptation debugging output"),
	    sysctl_ieee80211_rssadapt_debug, 0, &ieee80211_rssadapt_debug, 0,
	    CTL_CREATE, CTL_EOL)) != 0)
		goto err;
#endif /* IEEE80211_DEBUG */

	/* control rate of decay for exponential averages */
	if ((rc = sysctl_createv(clog, 0, &node, NULL,
	    CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_STRUCT,
	    "expavgctl", SYSCTL_DESCR("RSS exponential averaging control"),
	    sysctl_ieee80211_rssadapt_expavgctl, 0,
	    &master_expavgctl, sizeof(master_expavgctl), CTL_CREATE,
	    CTL_EOL)) != 0)
		goto err;

	return;
err:
	printf("%s: sysctl_createv failed (rc = %d)\n", __func__, rc);
}
Example #12
0
static int
cd9660_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&cd9660_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&cd9660_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT, CTLTYPE_NODE, "vfs", NULL,
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_EOL);
		sysctl_createv(&cd9660_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT, CTLTYPE_NODE, "cd9660",
			       SYSCTL_DESCR("ISO-9660 file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, 14, CTL_EOL);
		sysctl_createv(&cd9660_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
			       CTLTYPE_INT, "utf8_joliet",
			       SYSCTL_DESCR("Encode Joliet filenames to UTF-8"),
			       NULL, 0, &cd9660_utf8_joliet, 0,
			       CTL_VFS, 14, CD9660_UTF8_JOLIET, CTL_EOL);
		/*
		 * XXX the "14" above could be dynamic, thereby eliminating
		 * one more instance of the "number to vfs" mapping problem,
		 * but "14" is the order as taken from sys/mount.h
		 */
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&cd9660_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&cd9660_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
/*
 * Top level filesystem related information gathering.
 */
void
compat_sysctl_vfs(struct sysctllog **clog)
{
	extern int nmountcompatnames;

	sysctl_createv(clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
		       CTLTYPE_INT, "maxtypenum",
		       SYSCTL_DESCR("Highest valid filesystem type number"),
		       NULL, nmountcompatnames, NULL, 0,
		       CTL_VFS, VFS_GENERIC, VFS_MAXTYPENUM, CTL_EOL);
	sysctl_createv(clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_STRUCT, "conf",
		       SYSCTL_DESCR("Filesystem configuration information"),
		       sysctl_vfs_generic_conf, 0, NULL,
		       sizeof(struct vfsconf),
		       CTL_VFS, VFS_GENERIC, VFS_CONF, CTL_EOL);
}
Example #14
0
void
cprng_init(void)
{
	static struct sysctllog *random_sysctllog;

	nist_ctr_initialize();

	sysctl_createv(&random_sysctllog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_INT, "urandom",
		       SYSCTL_DESCR("Random integer value"),
		       sysctl_kern_urnd, 0, NULL, 0,
		       CTL_KERN, KERN_URND, CTL_EOL);
	sysctl_createv(&random_sysctllog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_INT, "arandom",
		       SYSCTL_DESCR("n bytes of random data"),
		       sysctl_kern_arnd, 0, NULL, 0,
		       CTL_KERN, KERN_ARND, CTL_EOL);
}
Example #15
0
void
drm_sysctl_init(struct drm_sysctl_def *def)
{
	const void * const *b = def->bp, * const *e = def->ep;
	const struct sysctlnode *rnode = NULL, *cnode;
	const char *name = "drm2";

	int error;
	if ((error = sysctl_createv(&def->log, 0, NULL, &rnode,
	    CTLFLAG_PERMANENT, CTLTYPE_NODE, name,
	    SYSCTL_DESCR("DRM driver parameters"),
	    NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL)) != 0) {
		aprint_error("sysctl_createv returned %d, "
		    "for %s ignoring\n", error, name);
		return;
	}

	for (; b < e; b++) {
		const struct linux_module_param_info *p = *b;
		char copy[256], *n, *nn;
		strlcpy(copy, p->name, sizeof(copy));
		cnode = rnode;
		for (n = copy; (nn = strchr(n, '.')) != NULL; n = nn) {
			*nn++ = '\0';
			if ((error = drm_sysctl_node(n, &cnode, &def->log))
			    != 0) {
				aprint_error("sysctl_createv returned %d, "
				    "for %s ignoring\n", error, n);
				continue;
			}
		}
			
	        if ((error = sysctl_createv(&def->log, 0, &cnode,
		    &cnode, p->mode == 0600 ? CTLFLAG_READWRITE : 0,
		    drm_sysctl_get_type(p), n,
		    SYSCTL_DESCR(drm_sysctl_get_description(p, def)),
		    NULL, 0, p->ptr, 0, CTL_CREATE, CTL_EOL)) != 0)
			aprint_error("sysctl_createv returned %d, "
			    "for %s ignoring\n", error, n);
	}
}
Example #16
0
static ACPI_STATUS
sony_walk_cb(ACPI_HANDLE hnd, UINT32 v, void *context, void **status)
{
	struct sony_acpi_softc *sc = (void *)context;
	const struct sysctlnode *node, *snode;
	const char *name = acpi_name(hnd);
	ACPI_INTEGER acpi_val;
	char buf[SYSCTL_NAMELEN + 1], *ptr;
	int rv;

	if ((name = strrchr(name, '.')) == NULL)
		return AE_OK;

	name++;
	if ((*name != 'G') && (*name != 'S'))
		return AE_OK;

	(void)strlcpy(buf, name, sizeof(buf));
	*buf = 'G';

	/*
	 * We assume that if the 'get' of the name as an integer is
	 * successful it is ok.
	 */
	if (acpi_eval_integer(sc->sc_node->ad_handle, buf, &acpi_val))
		return AE_OK;

	for (ptr = buf; *ptr; ptr++)
		*ptr = tolower(*ptr);

	if ((rv = sysctl_createv(&sc->sc_log, 0, NULL, &node, CTLFLAG_PERMANENT,
	    CTLTYPE_NODE, "hw", NULL, NULL, 0, NULL, 0, CTL_HW, CTL_EOL)) != 0)
		goto out;

	if ((rv = sysctl_createv(&sc->sc_log, 0, &node, &snode, 0,
	    CTLTYPE_NODE, device_xname(sc->sc_dev),
	    SYSCTL_DESCR("sony controls"),
	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0)
		goto out;

	if ((rv = sysctl_createv(&sc->sc_log, 0, &snode, &node,
	    CTLFLAG_READWRITE, CTLTYPE_INT, buf + 1, NULL,
	    sony_sysctl_helper, 0, sc, 0, CTL_CREATE, CTL_EOL)) != 0)
		goto out;

out:
#ifdef DIAGNOSTIC
	if (rv)
		printf("%s: sysctl_createv failed (rv = %d)\n",
		    device_xname(sc->sc_dev), rv);
#endif
	return AE_OK;
}
Example #17
0
static void
asus_sysctl_setup(struct asus_softc *sc)
{
	const struct sysctlnode *node, *node_cfv, *node_ncfv;
	int err, node_mib;

	if (sc->sc_cfvnum == 0)
		return;

	err = sysctl_createv(&sc->sc_log, 0, NULL, &node, 0,
	    CTLTYPE_NODE, device_xname(sc->sc_dev), NULL, NULL, 0,
	    NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL);
	if (err)
		goto sysctl_err;
	node_mib = node->sysctl_num;
	err = sysctl_createv(&sc->sc_log, 0, NULL, &node_ncfv,
	    CTLFLAG_READONLY, CTLTYPE_QUAD, "ncfv",
	    SYSCTL_DESCR("Number of CPU frequency/voltage modes"),
	    NULL, 0, &sc->sc_cfvnum, 0,
	    CTL_HW, node_mib, CTL_CREATE, CTL_EOL);
	if (err)
		goto sysctl_err;
	sc->sc_cfvnum_mib = node_ncfv->sysctl_num;
	err = sysctl_createv(&sc->sc_log, 0, NULL, &node_cfv,
	    CTLFLAG_READWRITE, CTLTYPE_INT, "cfv",
	    SYSCTL_DESCR("Current CPU frequency/voltage mode"),
	    asus_sysctl_verify, 0, (void *)sc, 0,
	    CTL_HW, node_mib, CTL_CREATE, CTL_EOL);
	if (err)
		goto sysctl_err;
	sc->sc_cfv_mib = node_cfv->sysctl_num;

	return;
sysctl_err:
	aprint_error_dev(sc->sc_dev, "failed to add sysctl nodes. (%d)\n", err);
}
Example #18
0
static void
xbseeprom_attach(device_t parent, device_t self, void *opaque)
{
	struct xbseeprom_softc *sc = device_private(self);
	struct i2c_attach_args *ia = opaque;
	uint8_t *ptr;
	int i;

	sc->sc_dev = self;
	sc->sc_tag = ia->ia_tag;
	sc->sc_addr = ia->ia_addr;

	sc->sc_data = kmem_alloc(XBSEEPROM_SIZE, KM_SLEEP);
	if (sc->sc_data == NULL) {
		aprint_error(": Not enough memory to copy EEPROM\n");
		return;
	}

	aprint_normal(": Xbox Serial EEPROM\n");

	/* Read in EEPROM contents */
	ptr = (uint8_t *)sc->sc_data;
	for (i = 0; i < XBSEEPROM_SIZE; i++, ptr++)
		xbseeprom_read_1(sc, i, ptr);

#if 0
	/* Display some interesting information */
	aprint_normal_dev(self, "MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",
	    sc->sc_data->MACAddress[0], sc->sc_data->MACAddress[1],
	    sc->sc_data->MACAddress[2], sc->sc_data->MACAddress[3],
	    sc->sc_data->MACAddress[4], sc->sc_data->MACAddress[5]
	    );
#endif

	/* Setup sysctl subtree */
	memset(xbseeprom_serial, 0, sizeof(xbseeprom_serial));
	memcpy(xbseeprom_serial, sc->sc_data->SerialNumber, 16);

	sysctl_createv(NULL, 0, NULL, NULL,
	    0, CTLTYPE_STRING, "xbox_serial",
	    SYSCTL_DESCR("Xbox serial number"),
	    NULL, 0, &xbseeprom_serial, 0,
	    CTL_MACHDEP, CTL_CREATE, CTL_EOL);

	return;
}
Example #19
0
static void
ufsdirhash_sysctl_init(void)
{
	const struct sysctlnode *rnode, *cnode;

	sysctl_createv(&ufsdirhash_sysctl_log, 0, NULL, &rnode,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "vfs", NULL,
		       NULL, 0, NULL, 0,
		       CTL_VFS, CTL_EOL);

	sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &rnode,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "ufs",
		       SYSCTL_DESCR("ufs"),
		       NULL, 0, NULL, 0,
		       CTL_CREATE, CTL_EOL);

	sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &rnode,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "dirhash",
		       SYSCTL_DESCR("dirhash"),
		       NULL, 0, NULL, 0,
		       CTL_CREATE, CTL_EOL);

	sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &cnode,
		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
		       CTLTYPE_INT, "minblocks",
		       SYSCTL_DESCR("minimum hashed directory size in blocks"),
		       NULL, 0, &ufs_dirhashminblks, 0,
		       CTL_CREATE, CTL_EOL);

	sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &cnode,
		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
		       CTLTYPE_INT, "maxmem",
		       SYSCTL_DESCR("maximum dirhash memory usage"),
		       NULL, 0, &ufs_dirhashmaxmem, 0,
		       CTL_CREATE, CTL_EOL);

	sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &cnode,
		       CTLFLAG_PERMANENT|CTLFLAG_READONLY,
		       CTLTYPE_INT, "memused",
		       SYSCTL_DESCR("current dirhash memory usage"),
		       NULL, 0, &ufs_dirhashmem, 0,
		       CTL_CREATE, CTL_EOL);

	sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &cnode,
		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
		       CTLTYPE_INT, "docheck",
		       SYSCTL_DESCR("enable extra sanity checks"),
		       NULL, 0, &ufs_dirhashcheck, 0,
		       CTL_CREATE, CTL_EOL);
}
static int
procfs_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&procfs_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&procfs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "vfs", NULL,
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_EOL);
		sysctl_createv(&procfs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "procfs",
			       SYSCTL_DESCR("Process file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, 12, CTL_EOL);
		/*
		 * XXX the "12" above could be dynamic, thereby eliminating
		 * one more instance of the "number to vfs" mapping problem,
		 * but "12" is the order as taken from sys/mount.h
		 */

		procfs_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS,
		    procfs_listener_cb, NULL);

		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&procfs_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&procfs_sysctl_log);
		kauth_unlisten_scope(procfs_listener);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
Example #21
0
static int
mfs_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&mfs_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&mfs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "vfs", NULL,
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_EOL);
		sysctl_createv(&mfs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT|CTLFLAG_ALIAS,
			       CTLTYPE_NODE, "mfs",
			       SYSCTL_DESCR("Memory based file system"),
			       NULL, 1, NULL, 0,
			       CTL_VFS, 3, CTL_EOL);
		/*
		 * XXX the "1" and the "3" above could be dynamic, thereby
		 * eliminating one more instance of the "number to vfs"
		 * mapping problem, but they are in order as taken from
		 * sys/mount.h
		 */
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&mfs_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&mfs_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
Example #22
0
static int
vmt_sysctl_setup_clock_sync(device_t self, const struct sysctlnode *root_node)
{
	const struct sysctlnode *node, *period_node;
	struct vmt_softc *sc = device_private(self);
	int rv;

	rv = sysctl_createv(&sc->sc_log, 0, &root_node, &node,
	    0, CTLTYPE_NODE, "clock_sync", NULL,
	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
	if (rv != 0)
		return rv;

	rv = sysctl_createv(&sc->sc_log, 0, &node, &period_node,
	    CTLFLAG_READWRITE, CTLTYPE_INT, "period",
	    SYSCTL_DESCR("Period, in seconds, at which to update the "
	        "guest's clock"),
	    vmt_sysctl_update_clock_sync_period, 0, (void *)sc, 0,
	    CTL_CREATE, CTL_EOL);
	return rv;
}
Example #23
0
static int
ext2fs_modcmd(modcmd_t cmd, void *arg)
{
//	printf("In file: %s, fun: %s,lineno: %d\n",__FILE__, __func__, __LINE__);
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&ext2fs_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&ext2fs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "ext2fs",
			       SYSCTL_DESCR("Linux EXT2FS file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, 17, CTL_EOL);
		/*
		 * XXX the "17" above could be dynamic, thereby eliminating
		 * one more instance of the "number to vfs" mapping problem,
		 * but "17" is the order as taken from sys/mount.h
		 */
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&ext2fs_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&ext2fs_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
Example #24
0
void
sysctl_security_overlay_setup(struct sysctllog **clog)
{
	const struct sysctlnode *rnode;

	sysctl_createv(clog, 0, NULL, &rnode,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "models", NULL,
		       NULL, 0, NULL, 0,
		       CTL_SECURITY, CTL_CREATE, CTL_EOL);

	sysctl_createv(clog, 0, &rnode, &rnode,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "overlay",
		       SYSCTL_DESCR("Overlay security model on-top of bsd44"),
		       NULL, 0, NULL, 0,
		       CTL_CREATE, CTL_EOL);

	sysctl_createv(clog, 0, &rnode, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_STRING, "name", NULL,
		       NULL, 0, __UNCONST(SECMODEL_OVERLAY_NAME), 0,
		       CTL_CREATE, CTL_EOL);
}
Example #25
0
/*
 * Attach a supported board.
 *
 * XXX This doesn't fail gracefully.
 */
static void
twe_attach(device_t parent, device_t self, void *aux)
{
	struct pci_attach_args *pa;
	struct twe_softc *sc;
	pci_chipset_tag_t pc;
	pci_intr_handle_t ih;
	pcireg_t csr;
	const char *intrstr;
	int s, size, i, rv, rseg;
	size_t max_segs, max_xfer;
	bus_dma_segment_t seg;
	const struct sysctlnode *node;
	struct twe_cmd *tc;
	struct twe_ccb *ccb;

	sc = device_private(self);
	sc->sc_dev = self;
	pa = aux;
	pc = pa->pa_pc;
	sc->sc_dmat = pa->pa_dmat;
	SIMPLEQ_INIT(&sc->sc_ccb_queue);
	SLIST_INIT(&sc->sc_ccb_freelist);

	aprint_naive(": RAID controller\n");
	aprint_normal(": 3ware Escalade\n");


	if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0,
	    &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) {
		aprint_error_dev(self, "can't map i/o space\n");
		return;
	}

	/* Enable the device. */
	csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
	pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
	    csr | PCI_COMMAND_MASTER_ENABLE);

	/* Map and establish the interrupt. */
	if (pci_intr_map(pa, &ih)) {
		aprint_error_dev(self, "can't map interrupt\n");
		return;
	}

	intrstr = pci_intr_string(pc, ih);
	sc->sc_ih = pci_intr_establish(pc, ih, IPL_BIO, twe_intr, sc);
	if (sc->sc_ih == NULL) {
		aprint_error_dev(self, "can't establish interrupt%s%s\n",
			(intrstr) ? " at " : "",
			(intrstr) ? intrstr : "");
		return;
	}

	if (intrstr != NULL)
		aprint_normal_dev(self, "interrupting at %s\n",
			intrstr);

	/*
	 * Allocate and initialise the command blocks and CCBs.
	 */
	size = sizeof(struct twe_cmd) * TWE_MAX_QUEUECNT;

	if ((rv = bus_dmamem_alloc(sc->sc_dmat, size, PAGE_SIZE, 0, &seg, 1,
	    &rseg, BUS_DMA_NOWAIT)) != 0) {
		aprint_error_dev(self, "unable to allocate commands, rv = %d\n", rv);
		return;
	}

	if ((rv = bus_dmamem_map(sc->sc_dmat, &seg, rseg, size,
	    (void **)&sc->sc_cmds,
	    BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) {
		aprint_error_dev(self, "unable to map commands, rv = %d\n", rv);
		return;
	}

	if ((rv = bus_dmamap_create(sc->sc_dmat, size, size, 1, 0,
	    BUS_DMA_NOWAIT, &sc->sc_dmamap)) != 0) {
		aprint_error_dev(self, "unable to create command DMA map, rv = %d\n", rv);
		return;
	}

	if ((rv = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap, sc->sc_cmds,
	    size, NULL, BUS_DMA_NOWAIT)) != 0) {
		aprint_error_dev(self, "unable to load command DMA map, rv = %d\n", rv);
		return;
	}

	ccb = malloc(sizeof(*ccb) * TWE_MAX_QUEUECNT, M_DEVBUF, M_NOWAIT);
	if (ccb == NULL) {
		aprint_error_dev(self, "unable to allocate memory for ccbs\n");
		return;
	}

	sc->sc_cmds_paddr = sc->sc_dmamap->dm_segs[0].ds_addr;
	memset(sc->sc_cmds, 0, size);

	sc->sc_ccbs = ccb;
	tc = (struct twe_cmd *)sc->sc_cmds;
	max_segs = twe_get_maxsegs();
	max_xfer = twe_get_maxxfer(max_segs);

	for (i = 0; i < TWE_MAX_QUEUECNT; i++, tc++, ccb++) {
		ccb->ccb_cmd = tc;
		ccb->ccb_cmdid = i;
		ccb->ccb_flags = 0;
		rv = bus_dmamap_create(sc->sc_dmat, max_xfer,
		    max_segs, PAGE_SIZE, 0,
		    BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
		    &ccb->ccb_dmamap_xfer);
		if (rv != 0) {
			aprint_error_dev(self, "can't create dmamap, rv = %d\n", rv);
			return;
		}

		/* Save the first CCB for AEN retrieval. */
		if (i != 0)
			SLIST_INSERT_HEAD(&sc->sc_ccb_freelist, ccb,
			    ccb_chain.slist);
	}

	/* Wait for the controller to become ready. */
	if (twe_status_wait(sc, TWE_STS_MICROCONTROLLER_READY, 6)) {
		aprint_error_dev(self, "microcontroller not ready\n");
		return;
	}

	twe_outl(sc, TWE_REG_CTL, TWE_CTL_DISABLE_INTRS);

	/* Reset the controller. */
	s = splbio();
	rv = twe_reset(sc);
	splx(s);
	if (rv) {
		aprint_error_dev(self, "reset failed\n");
		return;
	}

	/* Initialise connection with controller. */
	twe_init_connection(sc);

	twe_describe_controller(sc);

	/* Find and attach RAID array units. */
	sc->sc_nunits = 0;
	for (i = 0; i < TWE_MAX_UNITS; i++)
		(void) twe_add_unit(sc, i);

	/* ...and finally, enable interrupts. */
	twe_outl(sc, TWE_REG_CTL, TWE_CTL_CLEAR_ATTN_INTR |
	    TWE_CTL_UNMASK_RESP_INTR |
	    TWE_CTL_ENABLE_INTRS);

	/* sysctl set-up for 3ware cli */
	if (sysctl_createv(NULL, 0, NULL, NULL,
				CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw",
				NULL, NULL, 0, NULL, 0,
				CTL_HW, CTL_EOL) != 0) {
		aprint_error_dev(self, "could not create %s sysctl node\n",
			"hw");
		return;
	}
	if (sysctl_createv(NULL, 0, NULL, &node,
				0, CTLTYPE_NODE, device_xname(self),
				SYSCTL_DESCR("twe driver information"),
				NULL, 0, NULL, 0,
				CTL_HW, CTL_CREATE, CTL_EOL) != 0) {
		aprint_error_dev(self, "could not create %s.%s sysctl node\n",
			"hw", device_xname(self));
		return;
	}
	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
				0, CTLTYPE_STRING, "driver_version",
				SYSCTL_DESCR("twe0 driver version"),
				NULL, 0, __UNCONST(&twever), 0,
				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
				!= 0) {
		aprint_error_dev(self, "could not create %s.%s.driver_version sysctl\n",
			"hw", device_xname(self));
		return;
	}
}
Example #26
0
SYSCTL_SETUP(sysctl_security_keylock_setup,
    "sysctl security keylock setup")
{
	const struct sysctlnode *rnode;

	sysctl_createv(clog, 0, NULL, &rnode,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "models", NULL,
		       NULL, 0, NULL, 0,
		       CTL_SECURITY, CTL_CREATE, CTL_EOL);

	sysctl_createv(clog, 0, &rnode, &rnode,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "keylock",
		       SYSCTL_DESCR("Keylock security model"),
		       NULL, 0, NULL, 0,
		       CTL_CREATE, CTL_EOL);

	sysctl_createv(clog, 0, &rnode, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_STRING, "name", NULL,
		       NULL, 0, __UNCONST("Keylock"), 0,
		       CTL_CREATE, CTL_EOL);
}

void
secmodel_keylock_init(void)
{
	int error = secmodel_register(&keylock_sm,
	    "org.netbsd.secmodel.keylock",
Example #27
0
	newsize = seminfo.semmnu;
	error = sysctl_lookup(SYSCTLFN_CALL(&node));
	if (error || newp == NULL)
		return error;

	return semrealloc(seminfo.semmni, seminfo.semmns, newsize);
}

SYSCTL_SETUP(sysctl_ipc_sem_setup, "sysctl kern.ipc subtree setup")
{
	const struct sysctlnode *node = NULL;

	sysctl_createv(clog, 0, NULL, &node,
		CTLFLAG_PERMANENT,
		CTLTYPE_NODE, "ipc",
		SYSCTL_DESCR("SysV IPC options"),
		NULL, 0, NULL, 0,
		CTL_KERN, KERN_SYSVIPC, CTL_EOL);

	if (node == NULL)
		return;

	sysctl_createv(clog, 0, &node, NULL,
		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
		CTLTYPE_INT, "semmni",
		SYSCTL_DESCR("Max number of number of semaphore identifiers"),
		sysctl_ipc_semmni, 0, &seminfo.semmni, 0,
		CTL_CREATE, CTL_EOL);
	sysctl_createv(clog, 0, &node, NULL,
		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
		CTLTYPE_INT, "semmns",
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: init_sysctl_base.c,v 1.1 2009/09/16 15:03:56 pooka Exp $");

#include <sys/param.h>
#include <sys/sysctl.h>

/*
 * sets up the base nodes...
 */
SYSCTL_SETUP(sysctl_root_setup, "sysctl base setup")
{

	sysctl_createv(clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "kern",
		       SYSCTL_DESCR("High kernel"),
		       NULL, 0, NULL, 0,
		       CTL_KERN, CTL_EOL);
	sysctl_createv(clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "vm",
		       SYSCTL_DESCR("Virtual memory"),
		       NULL, 0, NULL, 0,
		       CTL_VM, CTL_EOL);
	sysctl_createv(clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "vfs",
		       SYSCTL_DESCR("Filesystem"),
		       NULL, 0, NULL, 0,
		       CTL_VFS, CTL_EOL);
	sysctl_createv(clog, 0, NULL, NULL,
	return (0);
}

SYSCTL_SETUP(sysctl_kern_gprof_setup, "sysctl kern.profiling subtree setup")
{

	sysctl_createv(clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "kern", NULL,
		       NULL, 0, NULL, 0,
		       CTL_KERN, CTL_EOL);
	sysctl_createv(clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_NODE, "profiling",
		       SYSCTL_DESCR("Profiling information (available)"),
		       NULL, 0, NULL, 0,
		       CTL_KERN, KERN_PROF, CTL_EOL);

	sysctl_createv(clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
		       CTLTYPE_INT, "state",
		       SYSCTL_DESCR("Profiling state"),
		       sysctl_kern_profiling, 0, NULL, 0,
		       CTL_KERN, KERN_PROF, GPROF_STATE, CTL_EOL);
	sysctl_createv(clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
		       CTLTYPE_STRUCT, "count",
		       SYSCTL_DESCR("Array of statistical program counters"),
		       sysctl_kern_profiling, 0, NULL, 0,
		       CTL_KERN, KERN_PROF, GPROF_COUNT, CTL_EOL);
Example #30
0
SYSCTL_SETUP(sysctl_hw_ubt_debug_setup, "sysctl hw.ubt_debug setup")
{

	sysctl_createv(NULL, 0, NULL, NULL,
		CTLFLAG_PERMANENT,
		CTLTYPE_NODE, "hw",
		NULL,
		NULL, 0,
		NULL, 0,
		CTL_HW, CTL_EOL);

	sysctl_createv(NULL, 0, NULL, NULL,
		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
		CTLTYPE_INT, "ubt_debug",
		SYSCTL_DESCR("ubt debug level"),
		NULL, 0,
		&ubt_debug, sizeof(ubt_debug),
		CTL_HW, CTL_CREATE, CTL_EOL);
}
#else
#define DPRINTF(...)
#define DPRINTFN(...)
#endif

/*******************************************************************************
 *
 *	ubt softc structure
 *
 */