Ejemplo n.º 1
0
static int
ieee80211_alq_setlogging(int enable)
{
	int error;

	if (enable) {
		if (ieee80211_alq)
			alq_close(ieee80211_alq);

		error = alq_open(&ieee80211_alq,
		    ieee80211_alq_logfile,
		    curthread->td_ucred,
		    ALQ_DEFAULT_CMODE,
		    sizeof (struct ieee80211_alq_rec),
		    ieee80211_alq_qsize);
		ieee80211_alq_lost = 0;
		ieee80211_alq_logged = 0;
		printf("net80211: logging to %s enabled; "
		    "struct size %d bytes\n",
		    ieee80211_alq_logfile,
		    sizeof(struct ieee80211_alq_rec));
	} else {
		if (ieee80211_alq)
			alq_close(ieee80211_alq);
		ieee80211_alq = NULL;
		printf("net80211: logging disabled\n");
		error = 0;
	}
	return (error);
}
Ejemplo n.º 2
0
static int
sysctl_debug_ktr_alq_enable(SYSCTL_HANDLER_ARGS)
{
	int error;
	int enable;

	enable = ktr_alq_enabled;

	error = sysctl_handle_int(oidp, &enable, 0, req);
	if (error || !req->newptr)
		return (error);

	if (enable) {
		if (ktr_alq_enabled)
			return (0);
		error = alq_open(&ktr_alq, (const char *)ktr_alq_file,
		    req->td->td_ucred, ALQ_DEFAULT_CMODE,
		    sizeof(struct ktr_entry), ktr_alq_depth);
		if (error == 0) {
			ktr_alq_cnt = 0;
			ktr_alq_failed = 0;
			ktr_alq_enabled = 1;
		}
	} else {
		if (ktr_alq_enabled == 0)
			return (0);
		ktr_alq_enabled = 0;
		alq_close(ktr_alq);
		ktr_alq = NULL;
	}

	return (error);
}
Ejemplo n.º 3
0
void
nandsim_log_close(struct nandsim_softc *sc)
{

	if (nandsim_log_output == NANDSIM_OUTPUT_FILE) {
		memset(&string[str_index], 0, NANDSIM_ENTRY_SIZE - str_index);
		alq_write(sc->alq, (void *) string, ALQ_NOWAIT);
		str_index = 0;
		string[0] = '\0';
		alq_close(sc->alq);
	} else if (nandsim_log_output == NANDSIM_OUTPUT_RAM) {
		free(sc->log_buff, M_NANDSIM);
		sc->log_buff = NULL;
	}
}
Ejemplo n.º 4
0
static int
ath_hal_setlogging(int enable)
{
	int error;

	if (enable) {
		error = alq_open(&ath_hal_alq, ath_hal_logfile,
			curthread->td_ucred, ALQ_DEFAULT_CMODE,
			sizeof (struct athregrec), ath_hal_alq_qsize);
		ath_hal_alq_lost = 0;
		ath_hal_alq_emitdev = 1;
		printf("ath_hal: logging to %s enabled\n",
			ath_hal_logfile);
	} else {
		if (ath_hal_alq)
			alq_close(ath_hal_alq);
		ath_hal_alq = NULL;
		printf("ath_hal: logging disabled\n");
		error = 0;
	}
	return (error);
}
Ejemplo n.º 5
0
static int
ath_hal_setlogging(int enable)
{
	int error;

	if (enable) {
		if (!capable(CAP_NET_ADMIN))
			return -EPERM;
		error = alq_open(&ath_hal_alq, ath_hal_logfile,
				MSG_MAXLEN, ath_hal_alq_qsize, (enable == 1 ? 0x7fffffff : enable));
		ath_hal_alq_lost = 0;
		printk(KERN_INFO "ath_hal: logging to %s %s\n", ath_hal_logfile,
			error == 0 ? "enabled" : "could not be setup");
	} else {
		if (ath_hal_alq)
			alq_close(ath_hal_alq);
		ath_hal_alq = NULL;
		printk(KERN_INFO "ath_hal: logging disabled\n");
		error = 0;
	}
	return error;
}
Ejemplo n.º 6
0
static int
ath_hal_setlogging(int enable)
{
	int error;

	if (enable) {
		if (!capable(CAP_NET_ADMIN))
			return -EPERM;
		error = alq_open(&ath_hal_alq, ath_hal_logfile,
				sizeof (struct athregrec), ath_hal_alq_qsize);
		ath_hal_alq_lost = 0;
		ath_hal_alq_emitdev = 1;
		printk("ath_hal: logging to %s %s\n", ath_hal_logfile,
			error == 0 ? "enabled" : "could not be setup");
	} else {
		if (ath_hal_alq)
			alq_close(ath_hal_alq);
		ath_hal_alq = NULL;
		printk("ath_hal: logging disabled\n");
		error = 0;
	}
	return error;
}