这篇教程C++ splimp函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中splimp函数的典型用法代码示例。如果您正苦于以下问题:C++ splimp函数的具体用法?C++ splimp怎么用?C++ splimp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了splimp函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: i4bread/*---------------------------------------------------------------------------* * i4bread - device driver read routine *---------------------------------------------------------------------------*/PDEVSTATIC inti4bread(dev_t dev, struct uio *uio, int ioflag){ struct mbuf *m; int x; int error = 0; if(minor(dev)) return(ENODEV); while(IF_QEMPTY(&i4b_rdqueue)) { x = splimp(); readflag = 1; splx(x); tsleep((caddr_t) &i4b_rdqueue, (PZERO + 1) | PCATCH, "bird", 0); } x = splimp(); IF_DEQUEUE(&i4b_rdqueue, m); splx(x); if(m && m->m_len) error = uiomove(m->m_data, m->m_len, uio); else error = EIO; if(m) i4b_Dfreembuf(m); return(error);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:37,
示例2: fwe_startstatic voidfwe_start(struct ifnet *ifp){ struct fwe_softc *fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe; int s; FWEDEBUG(ifp, "starting/n"); if (fwe->dma_ch < 0) { struct mbuf *m = NULL; FWEDEBUG(ifp, "not ready/n"); s = splimp(); do { IF_DEQUEUE(&ifp->if_snd, m); if (m != NULL) m_freem(m); if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } while (m != NULL); splx(s); return; } s = splimp(); ifp->if_drv_flags |= IFF_DRV_OACTIVE; if (ifp->if_snd.ifq_len != 0) fwe_as_output(fwe, ifp); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; splx(s);}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:34,
示例3: fwe_ioctlstatic intfwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data){ struct fwe_softc *fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe; struct ifstat *ifs = NULL; int s, error, len; switch (cmd) { case SIOCSIFFLAGS: s = splimp(); if (ifp->if_flags & IFF_UP) { if (!(ifp->if_flags & IFF_RUNNING)) fwe_init(&fwe->eth_softc); } else { if (ifp->if_flags & IFF_RUNNING) fwe_stop(fwe); } /* XXX keep promiscoud mode */ ifp->if_flags |= IFF_PROMISC; splx(s); break; case SIOCADDMULTI: case SIOCDELMULTI: break; case SIOCGIFSTATUS: s = splimp(); ifs = (struct ifstat *)data; len = strlen(ifs->ascii); if (len < sizeof(ifs->ascii)) snprintf(ifs->ascii + len, sizeof(ifs->ascii) - len, "/tch %d dma %d/n", fwe->stream_ch, fwe->dma_ch); splx(s); break;#if __FreeBSD_version >= 500000 default:#else case SIOCSIFADDR: case SIOCGIFADDR: case SIOCSIFMTU:#endif s = splimp(); error = ether_ioctl(ifp, cmd, data); splx(s); return (error);#if __FreeBSD_version < 500000 default: return (EINVAL);#endif } return (0);}
开发者ID:MarginC,项目名称:kame,代码行数:55,
示例4: dot1xintr/* ======================================================================== Routine Description: Compare two memory block Arguments: Adapter Pointer to our adapter Return Value: 0: memory is equal 1: pSrc1 memory is larger 2: pSrc2 memory is larger Note: ========================================================================*/ void dot1xintr() { //diag_printf("dot1xintr/n"); register struct mbuf *m; struct ifnet *ifp; int s; unsigned char *packet; int len; while (dot1xintrq.ifq_head) { s = splimp(); IF_DEQUEUE(&dot1xintrq, m); splx(s); if (m == 0 || (m->m_flags & M_PKTHDR) == 0) panic("dot1xintr"); packet = m->m_data-14;//br may change something like ATE len = m->m_len+14; DBGPRINT(RT_DEBUG_WARN, "%s :Receive SA (%02x:%02x:%02x:%02x:%02x:%02x)/n",__FUNCTION__,MAC2STR(packet));//PRINTF SA DBGPRINT(RT_DEBUG_WARN, "%s :Receive DA (%02x:%02x:%02x:%02x:%02x:%02x)/n",__FUNCTION__,MAC2STR(packet+6));//PRINTF DA //hex_dump("dot1xintr ===",packet,len); ifp = m->m_pkthdr.rcvif; Dot1xNetReceive(ifp, packet, len); m_freem(m); } }
开发者ID:houzhenggang,项目名称:mt7688_mips_ecos,代码行数:46,
示例5: i4bpoll/*---------------------------------------------------------------------------* * i4bpoll - device driver poll routine *---------------------------------------------------------------------------*/PDEVSTATIC inti4bpoll(dev_t dev, int events, struct proc *p){ int x; if(minor(dev)) return(ENODEV); if((events & POLLIN) || (events & POLLRDNORM)) { if(!IF_QEMPTY(&i4b_rdqueue)) return(1); x = splimp(); selrecord(p, &select_rd_info); selflag = 1; splx(x); return(0); } else if((events & POLLOUT) || (events & POLLWRNORM)) { return(1); } return(0);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:29,
示例6: i4bselect/*---------------------------------------------------------------------------* * i4bselect - device driver select routine *---------------------------------------------------------------------------*/PDEVSTATIC inti4bselect(dev_t dev, int rw, struct proc *p){ int x; if(minor(dev)) return(ENODEV); switch(rw) { case FREAD: if(!IF_QEMPTY(&i4b_rdqueue)) return(1); x = splimp(); selrecord(p, &select_rd_info); selflag = 1; splx(x); return(0); break; case FWRITE: return(1); break; } return(0);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:29,
示例7: fwip_detachstatic intfwip_detach(device_t dev){ struct fwip_softc *fwip; struct ifnet *ifp; int s; fwip = (struct fwip_softc *)device_get_softc(dev); ifp = fwip->fw_softc.fwip_ifp;#ifdef DEVICE_POLLING if (ifp->if_capenable & IFCAP_POLLING) ether_poll_deregister(ifp);#endif s = splimp(); fwip_stop(fwip); firewire_ifdetach(ifp); if_free(ifp); mtx_destroy(&fwip->mtx); splx(s); return 0;}
开发者ID:ChristosKa,项目名称:freebsd,代码行数:25,
示例8: fwe_detachstatic intfwe_detach(device_t dev){ struct fwe_softc *fwe; struct ifnet *ifp; int s; fwe = device_get_softc(dev); ifp = fwe->eth_softc.ifp;#ifdef DEVICE_POLLING if (ifp->if_capenable & IFCAP_POLLING) ether_poll_deregister(ifp);#endif s = splimp(); fwe_stop(fwe);#if defined(__DragonFly__) || __FreeBSD_version < 500000 ether_ifdetach(ifp, 1);#else ether_ifdetach(ifp); if_free(ifp);#endif splx(s); mtx_destroy(&fwe->mtx); return 0;}
开发者ID:ChristosKa,项目名称:freebsd,代码行数:28,
示例9: fwe_output_callbackstatic voidfwe_output_callback(struct fw_xfer *xfer){ struct fwe_softc *fwe; struct ifnet *ifp; int s; fwe = (struct fwe_softc *)xfer->sc; ifp = fwe->eth_softc.ifp; /* XXX error check */ FWEDEBUG(ifp, "resp = %d/n", xfer->resp); if (xfer->resp != 0) ifp->if_oerrors ++; m_freem(xfer->mbuf); fw_xfer_unload(xfer); s = splimp(); FWE_LOCK(fwe); STAILQ_INSERT_TAIL(&fwe->xferlist, xfer, link); FWE_UNLOCK(fwe); splx(s); /* for queue full */ if (ifp->if_snd.ifq_head != NULL) fwe_start(ifp);}
开发者ID:ChristosKa,项目名称:freebsd,代码行数:27,
示例10: pflogstart/* * Start output on the pflog interface. */voidpflogstart(struct ifnet *ifp){ struct mbuf *m;#ifndef __FreeBSD__ int s;#endif for (;;) {#ifdef __FreeBSD__ IF_LOCK(&ifp->if_snd); _IF_DROP(&ifp->if_snd); _IF_DEQUEUE(&ifp->if_snd, m); if (m == NULL) { IF_UNLOCK(&ifp->if_snd); return; } else m_freem(m); IF_UNLOCK(&ifp->if_snd); #else s = splimp(); IF_DROP(&ifp->if_snd); IF_DEQUEUE(&ifp->if_snd, m); splx(s); if (m == NULL) return; else m_freem(m);#endif }}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:35,
示例11: pptp_ctrlconn_disconnectint pptp_ctrlconn_disconnect(PPTP_INFO *pInfo){ struct pptp_ctrl_conn *ctrl_conn = pInfo->ctrl_conn; int s; if (!pInfo->ctrl_conn) return 0; s = splimp(); pptp_ctrlconn_stop(pInfo, PPTP_SCCR_REAS_LOCAL); if (ctrl_conn->call) pptp_ctrlconn_call_release(pInfo); if (ctrl_conn) { free(ctrl_conn); pInfo->ctrl_conn = NULL; } if (pInfo->ctrl_sock != -1) { close(pInfo->ctrl_sock); pInfo->ctrl_sock = -1; } pptp_timer_stop(pInfo); splx(s); return 0;}
开发者ID:houzhenggang,项目名称:mt7688_mips_ecos,代码行数:29,
示例12: udbp_in_transfer_cbStatic voidudbp_in_transfer_cb(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status err){ udbp_p sc = priv; /* XXX see priv above */ int s; int len; struct mbuf *m; if (err) { if (err != USBD_CANCELLED) { DPRINTF(("%s: bulk-out transfer failed: %s/n", USBDEVNAME(sc->sc_dev), usbd_errstr(err))); } else { /* USBD_CANCELLED happens at unload of the driver */ return; } /* Transfer has failed, packet is not received */ } else { len = xfer->actlen; s = splimp(); /* block network stuff too */ if (sc->hook) { /* get packet from device and send on */ m = m_devget(sc->sc_bulkin_buffer, len, 0, NULL, NULL); NG_SEND_DATA_ONLY(err, sc->hook, m); } splx(s); } /* schedule the next in transfer */ udbp_setup_in_transfer(sc);}
开发者ID:MarginC,项目名称:kame,代码行数:35,
示例13: Lpx_PCB_notify/* * Pass some notification to all connections of a protocol * associated with address dst. Call the * protocol specific routine to handle each connection. * Also pass an extra paramter via the lpxpcb. (which may in fact * be a parameter list!) */void Lpx_PCB_notify( register struct lpx_addr *dst, int errno, void (*notify)(struct lpxpcb *), long param ){ register struct lpxpcb *lpxp, *oinp; int s = splimp(); for (lpxp = (&lpxpcb)->lpxp_next; lpxp != (&lpxpcb);) { if (!lpx_hosteq(*dst,lpxp->lpxp_faddr)) { next: lpxp = lpxp->lpxp_next; continue; } if (lpxp->lpxp_socket == 0) goto next; if (errno) lpxp->lpxp_socket->so_error = errno; oinp = lpxp; lpxp = lpxp->lpxp_next; oinp->lpxp_notify_param = param; (*notify)(oinp); } splx(s);}
开发者ID:dansdrivers,项目名称:ndas4mac,代码行数:32,
示例14: ieresetstatic voidiereset(struct ie_softc *sc){ int s = splimp(); printf("ie%d: reset/n", sc->unit); sc->arpcom.ac_if.if_flags &= ~IFF_UP; ieioctl(&sc->arpcom.ac_if, SIOCSIFFLAGS, 0); /* * Stop i82586 dead in its tracks. */ if (command_and_wait(sc, IE_RU_ABORT | IE_CU_ABORT, 0, 0)) printf("ie%d: abort commands timed out/n", sc->unit); if (command_and_wait(sc, IE_RU_DISABLE | IE_CU_STOP, 0, 0)) printf("ie%d: disable commands timed out/n", sc->unit);#ifdef notdef if (!check_ie_present(sc)) panic("ie disappeared!");#endif sc->arpcom.ac_if.if_flags |= IFF_UP; ieioctl(&sc->arpcom.ac_if, SIOCSIFFLAGS, 0); splx(s); return;}
开发者ID:MarginC,项目名称:kame,代码行数:29,
示例15: tunclose/* * tunclose - close the device - mark i/f down & delete * routing info */static inttunclose(struct cdev *dev, int foo, int bar, struct thread *td){ struct tun_softc *tp; struct ifnet *ifp; int s; tp = dev->si_drv1; ifp = &tp->tun_if; mtx_lock(&tp->tun_mtx); tp->tun_flags &= ~TUN_OPEN; tp->tun_pid = 0; /* * junk all pending output */ s = splimp(); IFQ_PURGE(&ifp->if_snd); splx(s); mtx_unlock(&tp->tun_mtx); if (ifp->if_flags & IFF_UP) { s = splimp(); if_down(ifp); splx(s); } if (ifp->if_flags & IFF_RUNNING) { struct ifaddr *ifa; s = splimp(); /* find internet addresses and delete routes */ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET) /* Unlocked read. */ rtinit(ifa, (int)RTM_DELETE, tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0); ifp->if_flags &= ~IFF_RUNNING; splx(s); } funsetown(&tp->tun_sigio); selwakeuppri(&tp->tun_rsel, PZERO + 1); TUNDEBUG (ifp, "closed/n"); return (0);}
开发者ID:MarginC,项目名称:kame,代码行数:51,
示例16: fwip_attachstatic intfwip_attach(device_t dev){ struct fwip_softc *fwip; struct ifnet *ifp; int unit, s; struct fw_hwaddr *hwaddr; fwip = ((struct fwip_softc *)device_get_softc(dev)); unit = device_get_unit(dev); ifp = fwip->fw_softc.fwip_ifp = if_alloc(IFT_IEEE1394); if (ifp == NULL) return (ENOSPC); mtx_init(&fwip->mtx, "fwip", NULL, MTX_DEF); /* XXX */ fwip->dma_ch = -1; fwip->fd.fc = device_get_ivars(dev); if (tx_speed < 0) tx_speed = fwip->fd.fc->speed; fwip->fd.dev = dev; fwip->fd.post_explore = NULL; fwip->fd.post_busreset = fwip_post_busreset; fwip->fw_softc.fwip = fwip; TASK_INIT(&fwip->start_send, 0, fwip_start_send, fwip); /* * Encode our hardware the way that arp likes it. */ hwaddr = &IFP2FWC(fwip->fw_softc.fwip_ifp)->fc_hwaddr; hwaddr->sender_unique_ID_hi = htonl(fwip->fd.fc->eui.hi); hwaddr->sender_unique_ID_lo = htonl(fwip->fd.fc->eui.lo); hwaddr->sender_max_rec = fwip->fd.fc->maxrec; hwaddr->sspd = fwip->fd.fc->speed; hwaddr->sender_unicast_FIFO_hi = htons((uint16_t)(INET_FIFO >> 32)); hwaddr->sender_unicast_FIFO_lo = htonl((uint32_t)INET_FIFO); /* fill the rest and attach interface */ ifp->if_softc = &fwip->fw_softc; if_initname(ifp, device_get_name(dev), unit); ifp->if_init = fwip_init; ifp->if_start = fwip_start; ifp->if_ioctl = fwip_ioctl; ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST); ifp->if_snd.ifq_maxlen = TX_MAX_QUEUE;#ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING;#endif s = splimp(); firewire_ifattach(ifp, hwaddr); splx(s); FWIPDEBUG(ifp, "interface created/n"); return 0;}
开发者ID:markandrewj,项目名称:freebsd,代码行数:59,
示例17: splimpstruct mbuf *dequeue(struct ifqueue *inq){ struct mbuf *m = NULL; int s = splimp(); IF_DEQUEUE(inq, m); splx(s); return m;}
开发者ID:adugeek,项目名称:4.4BSD-Lite2,代码行数:8,
示例18: ipq_unlockstatic __inline voidipq_unlock(){ int s; s = splimp(); ipq_locked = 0; splx(s);}
开发者ID:LucidOne,项目名称:Rovio,代码行数:9,
示例19: i4b_Bcleanifq/*---------------------------------------------------------------------------* * clear a B-channel ifqueue from data *---------------------------------------------------------------------------*/voidi4b_Bcleanifq(struct ifqueue *ifq){ int x = splimp(); IF_DRAIN(ifq); splx(x);}
开发者ID:MarginC,项目名称:kame,代码行数:12,
示例20: el_reset/* This routine resets the interface. */void el_reset(int unit){ int s; dprintf(("elreset()/n")); s = splimp(); el_stop(unit); el_init(unit); splx(s);}
开发者ID:metacore,项目名称:spin,代码行数:11,
示例21: enqueuevoid enqueue(struct ifqueue *inq, struct mbuf *m){ int s = splimp(); if (IF_QFULL(inq)) { IF_DROP(inq); m_freem(m); } else IF_ENQUEUE(inq, m); splx(s);}
开发者ID:adugeek,项目名称:4.4BSD-Lite2,代码行数:10,
示例22: i4bclose/*---------------------------------------------------------------------------* * i4bclose - device driver close routine *---------------------------------------------------------------------------*/PDEVSTATIC inti4bclose(dev_t dev, int flag, int fmt, struct proc *p){ int x = splimp(); openflag = 0; i4b_l4_daemon_detached(); i4b_Dcleanifq(&i4b_rdqueue); splx(x); return(0);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:13,
示例23: fwe_startstatic voidfwe_start(struct ifnet *ifp){ struct fwe_softc *fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe; int s; FWEDEBUG(ifp, "starting/n"); if (fwe->dma_ch < 0) { struct mbuf *m = NULL; FWEDEBUG(ifp, "not ready/n"); s = splimp(); do { IF_DEQUEUE(&ifp->if_snd, m); if (m != NULL) m_freem(m); ifp->if_oerrors ++; } while (m != NULL); splx(s); return; } s = splimp();#if defined(__FreeBSD__) ifp->if_drv_flags |= IFF_DRV_OACTIVE;#else ifp->if_flags |= IFF_OACTIVE;#endif if (ifp->if_snd.ifq_len != 0) fwe_as_output(fwe, ifp);#if defined(__FreeBSD__) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;#else ifp->if_flags &= ~IFF_OACTIVE;#endif splx(s);}
开发者ID:ChristosKa,项目名称:freebsd,代码行数:42,
示例24: rmc_modclassintrmc_modclass(struct rm_class *cl, u_int nsecPerByte, int maxq, u_int maxidle, int minidle, u_int offtime, int pktsize){ struct rm_ifdat *ifd; u_int old_allotment; int s; ifd = cl->ifdat_; old_allotment = cl->allotment_;#ifdef __NetBSD__ s = splnet();#else s = splimp();#endif IFQ_LOCK(ifd->ifq_); cl->allotment_ = RM_NS_PER_SEC / nsecPerByte; /* Bytes per sec */ cl->qthresh_ = 0; cl->ns_per_byte_ = nsecPerByte; qlimit(cl->q_) = maxq;#if 1 /* minidle is also scaled in ALTQ */ cl->minidle_ = (minidle * nsecPerByte) / 8; if (cl->minidle_ > 0) cl->minidle_ = 0;#else cl->minidle_ = minidle;#endif cl->maxidle_ = (maxidle * nsecPerByte) / 8; if (cl->maxidle_ == 0) cl->maxidle_ = 1;#if 1 /* offtime is also scaled in ALTQ */ cl->avgidle_ = cl->maxidle_; cl->offtime_ = ((offtime * nsecPerByte) / 8) >> RM_FILTER_GAIN; if (cl->offtime_ == 0) cl->offtime_ = 1;#else cl->avgidle_ = 0; cl->offtime_ = (offtime * nsecPerByte) / 8;#endif /* * If CBQ's WRR is enabled, then initialize the class WRR state. */ if (ifd->wrr_) { ifd->alloc_[cl->pri_] += cl->allotment_ - old_allotment; rmc_wrr_set_weights(ifd); } IFQ_UNLOCK(ifd->ifq_); splx(s); return (0);}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:54,
示例25: hdintrvoidhdintr(){ register struct mbuf *m; register struct hdcb *hdp; register struct ifnet *ifp; register int s; static struct ifnet *lastifp; static struct hdcb *lasthdp; for (;;) { s = splimp(); IF_DEQUEUE(&hdintrq, m); splx(s); if (m == 0) break; if (m->m_len < HDHEADERLN) { printf("hdintr: packet too short (len=%d)/n", m->m_len); m_freem(m); continue; } if ((m->m_flags & M_PKTHDR) == 0) panic("hdintr"); ifp = m->m_pkthdr.rcvif; /* * look up the appropriate hdlc control block */ if (ifp == lastifp) hdp = lasthdp; else { for (hdp = hdcbhead; hdp; hdp = hdp->hd_next) if (hdp->hd_ifp == ifp) break; if (hdp == 0) { printf("hdintr: unknown interface %p/n", ifp); m_freem(m); continue; } lastifp = ifp; lasthdp = hdp; } /* * Process_rxframe returns FALSE if the frame was NOT queued * for the next higher layers. */ if (process_rxframe(hdp, m) == FALSE) m_freem(m); }}
开发者ID:MarginC,项目名称:kame,代码行数:53,
示例26: start_receiverstatic voidstart_receiver(struct ie_softc *sc){ int s = splimp(); sc->scb->ie_recv_list = MK_16(MEM(sc), sc->rframes[0]); command_and_wait(sc, IE_RU_START, 0, 0); ie_ack(sc, IE_ST_WHENCE); splx(s);}
开发者ID:MarginC,项目名称:kame,代码行数:12,
示例27: mbinitvoidmbinit(){ int s; s = splimp(); if (m_clalloc(max(4096/CLBYTES, 1), M_DONTWAIT) == 0) goto bad; splx(s); return;bad: panic("mbinit");}
开发者ID:Scarletts,项目名称:LiteBSD,代码行数:13,
示例28: ipq_lock_trystatic __inline intipq_lock_try(){ int s; s = splimp(); if (ipq_locked) { splx(s); return (0); } ipq_locked = 1; splx(s); return (1);}
开发者ID:LucidOne,项目名称:Rovio,代码行数:14,
注:本文中的splimp函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ spline函数代码示例 C++ splice函数代码示例 |