本文整理汇总了C++中splimp函数的典型用法代码示例。如果您正苦于以下问题:C++ splimp函数的具体用法?C++ splimp怎么用?C++ splimp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了splimp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: i4bread
/*---------------------------------------------------------------------------*
* i4bread - device driver read routine
*---------------------------------------------------------------------------*/
PDEVSTATIC int
i4bread(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,代码来源:i4b_i4bdrv.c
示例2: fwe_start
static void
fwe_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,代码来源:if_fwe.c
示例3: fwe_ioctl
static int
fwe_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,代码来源:if_fwe.c
示例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,代码来源:rtdot1x.c
示例5: i4bpoll
/*---------------------------------------------------------------------------*
* i4bpoll - device driver poll routine
*---------------------------------------------------------------------------*/
PDEVSTATIC int
i4bpoll(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,代码来源:i4b_i4bdrv.c
示例6: i4bselect
/*---------------------------------------------------------------------------*
* i4bselect - device driver select routine
*---------------------------------------------------------------------------*/
PDEVSTATIC int
i4bselect(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,代码来源:i4b_i4bdrv.c
示例7: fwip_detach
static int
fwip_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,代码来源:if_fwip.c
示例8: fwe_detach
static int
fwe_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,代码来源:if_fwe.c
示例9: fwe_output_callback
static void
fwe_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,代码来源:if_fwe.c
示例10: pflogstart
/*
* Start output on the pflog interface.
*/
void
pflogstart(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,代码来源:if_pflog.c
示例11: pptp_ctrlconn_disconnect
int 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,代码来源:pptp_ctrlconn.c
示例12: udbp_in_transfer_cb
Static void
udbp_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,代码来源:udbp.c
示例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,代码来源:lpx_pcb.c
示例14: iereset
static void
iereset(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,代码来源:if_ie.c
示例15: tunclose
/*
* tunclose - close the device - mark i/f down & delete
* routing info
*/
static int
tunclose(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,代码来源:if_tun.c
示例16: fwip_attach
static int
fwip_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,代码来源:if_fwip.c
示例17: splimp
struct 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,代码来源:ping.c
示例18: ipq_unlock
static __inline void
ipq_unlock()
{
int s;
s = splimp();
ipq_locked = 0;
splx(s);
}
开发者ID:LucidOne,项目名称:Rovio,代码行数:9,代码来源:ip_input.c
示例19: i4b_Bcleanifq
/*---------------------------------------------------------------------------*
* clear a B-channel ifqueue from data
*---------------------------------------------------------------------------*/
void
i4b_Bcleanifq(struct ifqueue *ifq)
{
int x = splimp();
IF_DRAIN(ifq);
splx(x);
}
开发者ID:MarginC,项目名称:kame,代码行数:12,代码来源:i4b_mbuf.c
示例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,代码来源:if_el.c
注:本文中的splimp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论