本文整理汇总了C++中splimp函数的典型用法代码示例。如果您正苦于以下问题:C++ splimp函数的具体用法?C++ splimp怎么用?C++ splimp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了splimp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}