当前位置: 首页>>代码示例>>C++>>正文


C++ KERNEL_UNLOCK_ONE函数代码示例

本文整理汇总了C++中KERNEL_UNLOCK_ONE函数的典型用法代码示例。如果您正苦于以下问题:C++ KERNEL_UNLOCK_ONE函数的具体用法?C++ KERNEL_UNLOCK_ONE怎么用?C++ KERNEL_UNLOCK_ONE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了KERNEL_UNLOCK_ONE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: intr_deliver

static void
intr_deliver(struct intr_source *is, int virq)
{
	bool locked = false;
	for (struct intrhand *ih = is->is_hand; ih != NULL; ih = ih->ih_next) {
		KASSERTMSG(ih->ih_fun != NULL,
		    "%s: irq %d, hwirq %d, is %p ih %p: "
		     "NULL interrupt handler!\n", __func__,
		     virq, is->is_hwirq, is, ih);
		if (ih->ih_ipl == IPL_VM) {
			if (!locked) {
				KERNEL_LOCK(1, NULL);
				locked = true;
			}
		} else if (locked) {
			KERNEL_UNLOCK_ONE(NULL);
			locked = false;
		}
		(*ih->ih_fun)(ih->ih_arg);
	}
	if (locked) {
		KERNEL_UNLOCK_ONE(NULL);
	}
	is->is_ev.ev_count++;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:25,代码来源:intr.c

示例2: tap_dev_kqfilter

static int
tap_dev_kqfilter(int unit, struct knote *kn)
{
	struct tap_softc *sc =
	    device_lookup_private(&tap_cd, unit);

	if (sc == NULL)
		return (ENXIO);

	KERNEL_LOCK(1, NULL);
	switch(kn->kn_filter) {
	case EVFILT_READ:
		kn->kn_fop = &tap_read_filterops;
		break;
	case EVFILT_WRITE:
		kn->kn_fop = &tap_seltrue_filterops;
		break;
	default:
		KERNEL_UNLOCK_ONE(NULL);
		return (EINVAL);
	}

	kn->kn_hook = sc;
	mutex_spin_enter(&sc->sc_kqlock);
	SLIST_INSERT_HEAD(&sc->sc_rsel.sel_klist, kn, kn_selnext);
	mutex_spin_exit(&sc->sc_kqlock);
	KERNEL_UNLOCK_ONE(NULL);
	return (0);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:29,代码来源:if_tap.c

示例3: tap_fops_close

/*
 * It might happen that the administrator used ifconfig to externally destroy
 * the interface.  In that case, tap_fops_close will be called while
 * tap_detach is already happening.  If we called it again from here, we
 * would dead lock.  TAP_GOING ensures that this situation doesn't happen.
 */
static int
tap_fops_close(file_t *fp)
{
	int unit = fp->f_devunit;
	struct tap_softc *sc;
	int error;

	sc = device_lookup_private(&tap_cd, unit);
	if (sc == NULL)
		return (ENXIO);

	/* tap_dev_close currently always succeeds, but it might not
	 * always be the case. */
	KERNEL_LOCK(1, NULL);
	if ((error = tap_dev_close(sc)) != 0) {
		KERNEL_UNLOCK_ONE(NULL);
		return (error);
	}

	/* Destroy the device now that it is no longer useful,
	 * unless it's already being destroyed. */
	if ((sc->sc_flags & TAP_GOING) != 0) {
		KERNEL_UNLOCK_ONE(NULL);
		return (0);
	}

	error = tap_clone_destroyer(sc->sc_dev);
	KERNEL_UNLOCK_ONE(NULL);
	return error;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:36,代码来源:if_tap.c

示例4: svr4_delete_socket

void
svr4_delete_socket(struct proc *p, struct file *fp)
{
    struct svr4_sockcache_entry *e;
    void *cookie = ((struct socket *) fp->f_data)->so_internal;

    KERNEL_LOCK(1, NULL);

    if (!initialized) {
        TAILQ_INIT(&svr4_head);
        initialized = 1;
        KERNEL_UNLOCK_ONE(NULL);
        return;
    }

    for (e = svr4_head.tqh_first; e != NULL; e = e->entries.tqe_next)
        if (e->p == p && e->cookie == cookie) {
            TAILQ_REMOVE(&svr4_head, e, entries);
            DPRINTF(("svr4_delete_socket: %s [%p,%"PRId64",%lu]\n",
                     e->sock.sun_path, p, e->dev, e->ino));
            free(e, M_TEMP);
            break;
        }

    KERNEL_UNLOCK_ONE(NULL);
}
开发者ID:rumpkernel-attic,项目名称:rumpkernel-netbsd-src,代码行数:26,代码来源:svr4_socket.c

示例5: npf_pfil_unregister

/*
 * npf_pfil_unregister: unregister pfil(9) hooks.
 */
void
npf_pfil_unregister(bool fini)
{
	npf_t *npf = npf_getkernctx();

	mutex_enter(softnet_lock);
	KERNEL_LOCK(1, NULL);

	if (fini && npf_ph_if) {
		(void)pfil_remove_hook(npf_ifhook, NULL,
		    PFIL_IFADDR | PFIL_IFNET, npf_ph_if);
	}
	if (npf_ph_inet) {
		(void)pfil_remove_hook(npf_packet_handler, npf,
		    PFIL_ALL, npf_ph_inet);
	}
	if (npf_ph_inet6) {
		(void)pfil_remove_hook(npf_packet_handler, npf,
		    PFIL_ALL, npf_ph_inet6);
	}
	pfil_registered = false;

	KERNEL_UNLOCK_ONE(NULL);
	mutex_exit(softnet_lock);
}
开发者ID:Mojo4242,项目名称:packetgraph,代码行数:28,代码来源:npf_handler.c

示例6: tcp_delack

/*
 * Callout to process delayed ACKs for a TCPCB.
 */
void
tcp_delack(void *arg)
{
	struct tcpcb *tp = arg;

	/*
	 * If tcp_output() wasn't able to transmit the ACK
	 * for whatever reason, it will restart the delayed
	 * ACK callout.
	 */

	mutex_enter(softnet_lock);
	if ((tp->t_flags & (TF_DEAD | TF_DELACK)) != TF_DELACK) {
		mutex_exit(softnet_lock);
		return;
	}
	if (!callout_expired(&tp->t_delack_ch)) {
		mutex_exit(softnet_lock);
		return;
	}

	tp->t_flags |= TF_ACKNOW;
	KERNEL_LOCK(1, NULL);
	(void) tcp_output(tp);
	KERNEL_UNLOCK_ONE(NULL);
	mutex_exit(softnet_lock);
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:30,代码来源:tcp_timer.c

示例7: npf_pfil_unregister

/*
 * npf_pfil_unregister: unregister pfil(9) hooks.
 */
void
npf_pfil_unregister(void)
{

	mutex_enter(softnet_lock);
	KERNEL_LOCK(1, NULL);

	if (npf_ph_if) {
		(void)pfil_remove_hook(npf_ifhook, NULL,
		    PFIL_IFADDR | PFIL_IFNET, npf_ph_if);
	}
	if (npf_ph_inet) {
		(void)pfil_remove_hook(npf_packet_handler, NULL,
		    PFIL_ALL, npf_ph_inet);
	}
	if (npf_ph_inet6) {
		(void)pfil_remove_hook(npf_packet_handler, NULL,
		    PFIL_ALL, npf_ph_inet6);
	}

	npf_ph_if = NULL;

	KERNEL_UNLOCK_ONE(NULL);
	mutex_exit(softnet_lock);
}
开发者ID:michaelb77,项目名称:C,代码行数:28,代码来源:npf_handler.c

示例8: tap_fops_stat

static int
tap_fops_stat(file_t *fp, struct stat *st)
{
	int error = 0;
	struct tap_softc *sc;
	int unit = fp->f_devunit;

	(void)memset(st, 0, sizeof(*st));

	KERNEL_LOCK(1, NULL);
	sc = device_lookup_private(&tap_cd, unit);
	if (sc == NULL) {
		error = ENXIO;
		goto out;
	}

	st->st_dev = makedev(cdevsw_lookup_major(&tap_cdevsw), unit);
	st->st_atimespec = sc->sc_atime;
	st->st_mtimespec = sc->sc_mtime;
	st->st_ctimespec = st->st_birthtimespec = sc->sc_btime;
	st->st_uid = kauth_cred_geteuid(fp->f_cred);
	st->st_gid = kauth_cred_getegid(fp->f_cred);
out:
	KERNEL_UNLOCK_ONE(NULL);
	return error;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:26,代码来源:if_tap.c

示例9: npf_pfil_register

/*
 * npf_pfil_register: register pfil(9) hooks.
 */
int
npf_pfil_register(bool init)
{
	npf_t *npf = npf_getkernctx();
	int error = 0;

	mutex_enter(softnet_lock);
	KERNEL_LOCK(1, NULL);

	/* Init: interface re-config and attach/detach hook. */
	if (!npf_ph_if) {
		npf_ph_if = pfil_head_get(PFIL_TYPE_IFNET, 0);
		if (!npf_ph_if) {
			error = ENOENT;
			goto out;
		}
		error = pfil_add_hook(npf_ifhook, NULL,
		    PFIL_IFADDR | PFIL_IFNET, npf_ph_if);
		KASSERT(error == 0);
	}
	if (init) {
		goto out;
	}

	/* Check if pfil hooks are not already registered. */
	if (pfil_registered) {
		error = EEXIST;
		goto out;
	}

	/* Capture points of the activity in the IP layer. */
	npf_ph_inet = pfil_head_get(PFIL_TYPE_AF, (void *)AF_INET);
	npf_ph_inet6 = pfil_head_get(PFIL_TYPE_AF, (void *)AF_INET6);
	if (!npf_ph_inet && !npf_ph_inet6) {
		error = ENOENT;
		goto out;
	}

	/* Packet IN/OUT handlers for IP layer. */
	if (npf_ph_inet) {
		error = pfil_add_hook(npf_packet_handler, npf,
		    PFIL_ALL, npf_ph_inet);
		KASSERT(error == 0);
	}
	if (npf_ph_inet6) {
		error = pfil_add_hook(npf_packet_handler, npf,
		    PFIL_ALL, npf_ph_inet6);
		KASSERT(error == 0);
	}
	pfil_registered = true;
out:
	KERNEL_UNLOCK_ONE(NULL);
	mutex_exit(softnet_lock);

	return error;
}
开发者ID:Mojo4242,项目名称:packetgraph,代码行数:59,代码来源:npf_handler.c

示例10: tap_fops_read

static int
tap_fops_read(file_t *fp, off_t *offp, struct uio *uio,
    kauth_cred_t cred, int flags)
{
	int error;

	KERNEL_LOCK(1, NULL);
	error = tap_dev_read(fp->f_devunit, uio, flags);
	KERNEL_UNLOCK_ONE(NULL);
	return error;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:11,代码来源:if_tap.c

示例11: tap_fops_write

static int
tap_fops_write(file_t *fp, off_t *offp, struct uio *uio,
    kauth_cred_t cred, int flags)
{
	int error;

	KERNEL_LOCK(1, NULL);
	error = tap_dev_write((intptr_t)fp->f_data, uio, flags);
	KERNEL_UNLOCK_ONE(NULL);
	return error;
}
开发者ID:bigclouds,项目名称:netbsd_dpdk_port,代码行数:11,代码来源:if_tap.c

示例12: wrapifioctl

static int
wrapifioctl(struct socket *so, u_long cmd, void *data)
{
	int rv;

	KERNEL_LOCK(1, NULL);
	rv = ifioctl(so, cmd, data, curlwp);
	KERNEL_UNLOCK_ONE(NULL);

	return rv;
}
开发者ID:huikang,项目名称:buildrump.sh,代码行数:11,代码来源:netconfig.c

示例13: tap_kqdetach

static void
tap_kqdetach(struct knote *kn)
{
	struct tap_softc *sc = (struct tap_softc *)kn->kn_hook;

	KERNEL_LOCK(1, NULL);
	mutex_spin_enter(&sc->sc_kqlock);
	SLIST_REMOVE(&sc->sc_rsel.sel_klist, kn, knote, kn_selnext);
	mutex_spin_exit(&sc->sc_kqlock);
	KERNEL_UNLOCK_ONE(NULL);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:11,代码来源:if_tap.c

示例14: svr4_add_socket

int
svr4_add_socket(struct proc *p, const char *path, struct stat *st)
{
    struct svr4_sockcache_entry *e;
    size_t len;
    int error;

    KERNEL_LOCK(1, NULL);

    if (!initialized) {
        TAILQ_INIT(&svr4_head);
        initialized = 1;
    }

    e = malloc(sizeof(*e), M_TEMP, M_WAITOK);
    e->cookie = NULL;
    e->dev = st->st_dev;
    e->ino = st->st_ino;
    e->p = p;

    if ((error = copyinstr(path, e->sock.sun_path,
                           sizeof(e->sock.sun_path), &len)) != 0) {
        DPRINTF(("svr4_add_socket: copyinstr failed %d\n", error));
        free(e, M_TEMP);
        KERNEL_UNLOCK_ONE(NULL);
        return error;
    }

    e->sock.sun_family = AF_LOCAL;
    e->sock.sun_len = len;

    TAILQ_INSERT_HEAD(&svr4_head, e, entries);
    DPRINTF(("svr4_add_socket: %s [%p,%"PRId64",%lu]\n", e->sock.sun_path,
             p, e->dev, e->ino));

    KERNEL_UNLOCK_ONE(NULL);
    return 0;
}
开发者ID:rumpkernel-attic,项目名称:rumpkernel-netbsd-src,代码行数:38,代码来源:svr4_socket.c

示例15: npf_pfil_register

/*
 * npf_pfil_register: register pfil(9) hooks.
 */
int
npf_pfil_register(void)
{
	int error;

	mutex_enter(softnet_lock);
	KERNEL_LOCK(1, NULL);

	/* Check if pfil hooks are not already registered. */
	if (npf_ph_if) {
		error = EEXIST;
		goto fail;
	}

	/* Capture point of any activity in interfaces and IP layer. */
	npf_ph_if = pfil_head_get(PFIL_TYPE_IFNET, 0);
	npf_ph_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
	npf_ph_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6);
	if (!npf_ph_if || (!npf_ph_inet && !npf_ph_inet6)) {
		npf_ph_if = NULL;
		error = ENOENT;
		goto fail;
	}

	/* Interface re-config or attach/detach hook. */
	error = pfil_add_hook(npf_ifhook, NULL,
	    PFIL_WAITOK | PFIL_IFADDR | PFIL_IFNET, npf_ph_if);
	KASSERT(error == 0);

	/* Packet IN/OUT handler on all interfaces and IP layer. */
	if (npf_ph_inet) {
		error = pfil_add_hook(npf_packet_handler, NULL,
		    PFIL_WAITOK | PFIL_ALL, npf_ph_inet);
		KASSERT(error == 0);
	}
	if (npf_ph_inet6) {
		error = pfil_add_hook(npf_packet_handler, NULL,
		    PFIL_WAITOK | PFIL_ALL, npf_ph_inet6);
		KASSERT(error == 0);
	}
fail:
	KERNEL_UNLOCK_ONE(NULL);
	mutex_exit(softnet_lock);

	return error;
}
开发者ID:michaelb77,项目名称:C,代码行数:49,代码来源:npf_handler.c


注:本文中的KERNEL_UNLOCK_ONE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。