• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ save_flags函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: remove_sock

static void remove_sock(struct sock *sk1)
{
	struct sock *sk2;
	unsigned long flags;

	if (!sk1->prot) 
	{
		printk("sock.c: remove_sock: sk1->prot == NULL\n");
		return;
	}

	/* We can't have this changing out from under us. */
	save_flags(flags);
	cli();
	sk2 = sk1->prot->sock_array[sk1->num &(SOCK_ARRAY_SIZE -1)];
	if (sk2 == sk1) 
	{
		sk1->prot->inuse -= 1;
		sk1->prot->sock_array[sk1->num &(SOCK_ARRAY_SIZE -1)] = sk1->next;
		restore_flags(flags);
		return;
	}

	while(sk2 && sk2->next != sk1) 
	{
		sk2 = sk2->next;
	}

	if (sk2) 
	{
		sk1->prot->inuse -= 1;
		sk2->next = sk1->next;
		restore_flags(flags);
		return;
	}
	restore_flags(flags);
}
开发者ID:abbshr,项目名称:Notes-HIT_computer_network,代码行数:37,代码来源:af_inet.c


示例2: test_new_size

  static void test_new_size() {
    size_t flag_value;

    save_flags();

    // If NewSize is set on the command line, it should be used
    // for both min and initial young size if less than min heap.
    flag_value = 20 * M;
    set_basic_flag_values();
    FLAG_SET_CMDLINE(size_t, NewSize, flag_value);
    verify_young_min(flag_value);

    set_basic_flag_values();
    FLAG_SET_CMDLINE(size_t, NewSize, flag_value);
    verify_young_initial(flag_value);

    // If NewSize is set on command line, but is larger than the min
    // heap size, it should only be used for initial young size.
    flag_value = 80 * M;
    set_basic_flag_values();
    FLAG_SET_CMDLINE(size_t, NewSize, flag_value);
    verify_young_initial(flag_value);

    // If NewSize has been ergonomically set, the collector policy
    // should use it for min but calculate the initial young size
    // using NewRatio.
    flag_value = 20 * M;
    set_basic_flag_values();
    FLAG_SET_ERGO(size_t, NewSize, flag_value);
    verify_young_min(flag_value);

    set_basic_flag_values();
    FLAG_SET_ERGO(size_t, NewSize, flag_value);
    verify_scaled_young_initial(InitialHeapSize);

    restore_flags();
  }
开发者ID:gaoxiaojun,项目名称:dync,代码行数:37,代码来源:collectorPolicy.cpp


示例3: amiga_insert_irq

static inline int amiga_insert_irq(irq_node_t **list, irq_node_t *node)
{
	unsigned long flags;
	irq_node_t *cur;

	if (!node->dev_id)
		printk("%s: Warning: dev_id of %s is zero\n",
		       __FUNCTION__, node->devname);

	save_flags(flags);
	cli();

	cur = *list;

	if (node->flags & SA_INTERRUPT) {
		if (node->flags & SA_SHIRQ)
			return -EBUSY;
		/*
		 * There should never be more than one
		 */
		while (cur && cur->flags & SA_INTERRUPT) {
			list = &cur->next;
			cur = cur->next;
		}
	} else {
		while (cur) {
			list = &cur->next;
			cur = cur->next;
		}
	}

	node->next = cur;
	*list = node;

	restore_flags(flags);
	return 0;
}
开发者ID:fgeraci,项目名称:cs518-sched,代码行数:37,代码来源:amiints.c


示例4: isac_empty_fifo

static void
isac_empty_fifo(struct IsdnCardState *sp, int count)
{
	u_char *ptr;
	long flags;

	if ((sp->debug & L1_DEB_ISAC) && !(sp->debug & L1_DEB_ISAC_FIFO))
		if (sp->debug & L1_DEB_ISAC)
			debugl1(sp, "isac_empty_fifo");

	if ((sp->rcvidx + count) >= MAX_DFRAME_LEN) {
		if (sp->debug & L1_DEB_WARN) {
			char tmp[40];
			sprintf(tmp, "isac_empty_fifo overrun %d",
				sp->rcvidx + count);
			debugl1(sp, tmp);
		}
		writereg(sp->isac, ISAC_CMDR, 0x80);
		sp->rcvidx = 0;
		return;
	}
	ptr = sp->rcvbuf + sp->rcvidx;
	sp->rcvidx += count;
	save_flags(flags);
	cli();
	read_fifo(sp->isac, ptr, count);
	writereg(sp->isac, ISAC_CMDR, 0x80);
	restore_flags(flags);
	if (sp->debug & L1_DEB_ISAC_FIFO) {
		char tmp[128];
		char *t = tmp;

		t += sprintf(t, "isac_empty_fifo cnt %d", count);
		QuickHex(t, ptr, count);
		debugl1(sp, tmp);
	}
}
开发者ID:rohsaini,项目名称:mkunity,代码行数:37,代码来源:teles3.c


示例5: amiga_insert_irq

void amiga_insert_irq(irq_node_t **list, irq_node_t *node)
{
	unsigned long flags;
	irq_node_t *cur;

	if (!node->dev_id)
		printk("%s: Warning: dev_id of %s is zero\n",
		       __FUNCTION__, node->devname);

	save_flags(flags);
	cli();

	cur = *list;

	if (node->flags & IRQ_FLG_FAST) {
		node->flags &= ~IRQ_FLG_SLOW;
		while (cur && cur->flags & IRQ_FLG_FAST) {
			list = &cur->next;
			cur = cur->next;
		}
	} else if (node->flags & IRQ_FLG_SLOW) {
		while (cur) {
			list = &cur->next;
			cur = cur->next;
		}
	} else {
		while (cur && !(cur->flags & IRQ_FLG_SLOW)) {
			list = &cur->next;
			cur = cur->next;
		}
	}

	node->next = cur;
	*list = node;

	restore_flags(flags);
}
开发者ID:shattered,项目名称:linux-m68k,代码行数:37,代码来源:amiints.c


示例6: handle_error

/* Clean up after an error. The caller should usually call do_request()
   after this function returns. It can be called from an IRQ handler or the
   normal kernel context. */
void handle_error(const char *from)
{
    u_long flags;
    if(current_req == NULL)
	return;
    save_flags(flags);
    cli();
    kprintf("\nfd: %s (%s): Error (retry number %d)\n",
        from, REQ_FD_DEV(current_req)->name, current_req->retries);
    dump_stat();
    fd_intr = NULL;
    if(current_req->retries++ < MAX_RETRIES)
    {
#if 0
	if((current_req->retries % RESET_FREQ) == 0)
	    reset_pending = TRUE;
#endif
	if((current_req->retries % RECAL_FREQ) == 0)
	    REQ_FD_DEV(current_req)->recalibrate = TRUE;
	/* Retry the current request, this simply means stacking it on the
	   front of the queue and calling do_request(). */
	prepend_node(&fd_reqs, &current_req->node);
	current_req = NULL;
	DB(("fd:handle_error: Retrying request %p\n", current_req));
    }
    else
    {
#if 0
	reset_pending = TRUE;
#endif
	REQ_FD_DEV(current_req)->recalibrate = TRUE;
	DB(("\nfd: handle_error: Request %p has no more retries available.\n",
	    current_req));
	fd_end_request(-1);
    }
    load_flags(flags);
}
开发者ID:spevans,项目名称:vmm386,代码行数:40,代码来源:floppy.c


示例7: SelFiFo

static int
SelFiFo(struct IsdnCardState *cs, u_char FiFo)
{
	u_char cip;
	long flags;


	if (cs->hw.hfcD.fifo == FiFo)
		return(1);
	save_flags(flags);
	cli();
	switch(FiFo) {
		case 0: cip = HFCB_FIFO | HFCB_Z1 | HFCB_SEND | HFCB_B1;
			break;
		case 1: cip = HFCB_FIFO | HFCB_Z1 | HFCB_REC | HFCB_B1;
			break;
		case 2: cip = HFCB_FIFO | HFCB_Z1 | HFCB_SEND | HFCB_B2;
			break;
		case 3: cip = HFCB_FIFO | HFCB_Z1 | HFCB_REC | HFCB_B2;
			break;
		case 4: cip = HFCD_FIFO | HFCD_Z1 | HFCD_SEND;
			break;
		case 5: cip = HFCD_FIFO | HFCD_Z1 | HFCD_REC;
			break;
		default:
			restore_flags(flags);
			debugl1(cs, "SelFiFo Error");
			return(0);
	}
	cs->hw.hfcD.fifo = FiFo;
	WaitNoBusy(cs);
	cs->BC_Write_Reg(cs, HFCD_DATA, cip, 0);
	sti();
	WaitForBusy(cs);
	restore_flags(flags);
	return(2);
}
开发者ID:shattered,项目名称:linux-m68k,代码行数:37,代码来源:hfc_2bds0.c


示例8: skb_queue_tail

/*
 *	Insert an sk_buff at the end of a list.
 */
void skb_queue_tail(struct sk_buff_head *list_, struct sk_buff *newsk)
{
	unsigned long flags;
	struct sk_buff *list = (struct sk_buff *)list_;

	save_flags(flags);
	cli();

	if (newsk->next || newsk->prev)
		printk("Suspicious queue tail: sk_buff on list!\n");
	IS_SKB(newsk);
	IS_SKB_HEAD(list);

	newsk->next = list;
	newsk->prev = list->prev;

	newsk->next->prev = newsk;
	newsk->prev->next = newsk;
	
	newsk->list = list_;
	list_->qlen++;

	restore_flags(flags);
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:27,代码来源:skbuff.c


示例9: NCR53c406a_dma_setup

static __inline__ int 
NCR53c406a_dma_setup (unsigned char *ptr, 
		      unsigned int count, 
		      unsigned char mode) {
    unsigned limit;
    unsigned long flags = 0;
    
    VDEB(printk("dma: before count=%d   ", count));
    if (dma_chan <=3) {
        if (count > 65536)
            count = 65536;
        limit = 65536 - (((unsigned) ptr) & 0xFFFF);
    } else {
        if (count > (65536<<1)) 
            count = (65536<<1);
        limit = (65536<<1) - (((unsigned) ptr) & 0x1FFFF);
    }
    
    if (count > limit) count = limit;
    
    VDEB(printk("after count=%d\n", count));
    if ((count & 1) || (((unsigned) ptr) & 1))
        panic ("NCR53c406a: attempted unaligned DMA transfer\n"); 
    
    save_flags(flags);
    cli();
    disable_dma(dma_chan);
    clear_dma_ff(dma_chan);
    set_dma_addr(dma_chan, (long) ptr);
    set_dma_count(dma_chan, count);
    set_dma_mode(dma_chan, mode);
    enable_dma(dma_chan);
    restore_flags(flags);
    
    return count;
}
开发者ID:openmach,项目名称:openmach,代码行数:36,代码来源:NCR53c406a.c


示例10: fd_select_drive

static void fd_select_drive(int drive)
{
	unsigned long flags;

#ifdef DEBUG
	printk("fd_select_drive:%d\n", drive);
#endif
	/* Hmm - nowhere do we seem to turn the motor on - I'm going to do it here! */
	oldlatch_aupdate(LATCHA_MOTOR | LATCHA_INUSE, 0);

	if (drive == SelectedDrive)
		return;

	save_flags(flags);
	cli();
	oldlatch_aupdate(LATCHA_FDSELALL, 0xf - (1 << drive));
	restore_flags(flags);

	/* restore track register to saved value */
	FDC1772_WRITE(FDC1772REG_TRACK, unit[drive].track);
	udelay(25);

	SelectedDrive = drive;
}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:24,代码来源:fd1772.c


示例11: editor_main

/* the main editor function */
void            editor_main(player * p, char *str)
{
   if (!p->edit_info)
   {
      log("error", "Editor called with no edit_info");
      return;
   }
   if (*str == '/')
   {
      restore_flags(p);
      match_commands(p, str + 1);
      save_flags(p);
      return;
   }
   if (*str == '.')
   {
      sub_command(p, str + 1, editor_list);
      if (p->edit_info)
    do_prompt(p, "+");
      return;
   }
   insert_line(p, str);
   do_prompt(p, "+");
}
开发者ID:talkers,项目名称:sensisummink,代码行数:25,代码来源:editor.c


示例12: savegame

void
savegame(struct memfile *mf)
{
    int count = 0;
    xchar ltmp;

    /* no tag useful here as store_version adds one */
    store_version(mf);

    /* Place flags, player info & moves at the beginning of the save. This
       makes it possible to read them in nh_get_savegame_status without parsing 
       all the dungeon and level data */
    save_flags(mf);
    save_you(mf, &u);
    mwrite32(mf, moves);        /* no tag useful here; you is fixed-length */
    save_mon(mf, &youmonst);

    /* store dungeon layout */
    save_dungeon(mf);
    savelevchn(mf);

    /* store levels */
    mtag(mf, 0, MTAG_LEVELS);
    for (ltmp = 1; ltmp <= maxledgerno(); ltmp++)
        if (levels[ltmp])
            count++;
    mwrite32(mf, count);
    for (ltmp = 1; ltmp <= maxledgerno(); ltmp++) {
        if (!levels[ltmp])
            continue;
        mtag(mf, ltmp, MTAG_LEVELS);
        mwrite8(mf, ltmp);      /* level number */
        savelev(mf, ltmp);      /* actual level */
    }
    savegamestate(mf);
}
开发者ID:chasetopher,项目名称:NetHack-4,代码行数:36,代码来源:save.c


示例13: ax25_listen_register

int ax25_listen_register(ax25_address *callsign, struct device *dev)
{
	struct listen_struct *listen;
	unsigned long flags;

	if (ax25_listen_mine(callsign, dev))
		return 0;

	if ((listen = (struct listen_struct *)kmalloc(sizeof(*listen), GFP_ATOMIC)) == NULL)
		return 0;

	listen->callsign = *callsign;
	listen->dev      = dev;

	save_flags(flags);
	cli();

	listen->next = listen_list;
	listen_list  = listen;

	restore_flags(flags);

	return 1;
}
开发者ID:shattered,项目名称:linux-m68k,代码行数:24,代码来源:ax25_timer.c


示例14: reset_netjet_u

static void
reset_netjet_u(struct IsdnCardState *cs)
{
	long flags;

	save_flags(flags);
	sti();
	cs->hw.njet.ctrl_reg = 0xff;  /* Reset On */
	byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
	set_current_state(TASK_UNINTERRUPTIBLE);
	schedule_timeout((10*HZ)/1000);	/* Timeout 10ms */
	cs->hw.njet.ctrl_reg = 0x40;  /* Reset Off and status read clear */
	/* now edge triggered for TJ320 GE 13/07/00 */
	byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
	set_current_state(TASK_UNINTERRUPTIBLE);
	schedule_timeout((10*HZ)/1000);	/* Timeout 10ms */
	restore_flags(flags);
	cs->hw.njet.auxd = 0xC0;
	cs->hw.njet.dmactrl = 0;
	byteout(cs->hw.njet.auxa, 0);
	byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ);
	byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ);
	byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
}
开发者ID:nhanh0,项目名称:hah,代码行数:24,代码来源:nj_u.c


示例15: skb_append

/*
 *	Place a packet after a given packet in a list.
 */
void skb_append(struct sk_buff *old, struct sk_buff *newsk)
{
	unsigned long flags;

	IS_SKB(old);
	IS_SKB(newsk);

	if(!old->next || !old->prev)
		printk("append before unlisted item!\n");
	if(newsk->next || newsk->prev)
		printk("append item is already on a list.\n");

	save_flags(flags);
	cli();

	newsk->prev = old;
	newsk->next = old->next;
	newsk->next->prev = newsk;
	old->next = newsk;
	newsk->list = old->list;
	newsk->list->qlen++;

	restore_flags(flags);
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:27,代码来源:skbuff.c


示例16: rose_remove_neigh

static void rose_remove_neigh(struct rose_neigh *rose_neigh)
{
	struct rose_neigh *s;
	unsigned long flags;

	rose_stop_ftimer(rose_neigh);
	rose_stop_t0timer(rose_neigh);

	skb_queue_purge(&rose_neigh->queue);

	save_flags(flags); cli();

	if ((s = rose_neigh_list) == rose_neigh) {
		rose_neigh_list = rose_neigh->next;
		restore_flags(flags);
		if (rose_neigh->digipeat != NULL)
			kfree(rose_neigh->digipeat);
		kfree(rose_neigh);
		return;
	}

	while (s != NULL && s->next != NULL) {
		if (s->next == rose_neigh) {
			s->next = rose_neigh->next;
			restore_flags(flags);
			if (rose_neigh->digipeat != NULL)
				kfree(rose_neigh->digipeat);
			kfree(rose_neigh);
			return;
		}

		s = s->next;
	}

	restore_flags(flags);
}
开发者ID:fgeraci,项目名称:cs518-sched,代码行数:36,代码来源:rose_route.c


示例17: pdc_console_wait_key

int pdc_console_wait_key(struct console *co)
{
	int ch = 'X';
	int status;

	/* Bail if no console input device. */
	if (!PAGE0->mem_kbd.iodc_io)
		return 0;
	
	/* wait for a keyboard (rs232)-input */
	do {
		unsigned long flags;

		save_flags(flags);
		cli();
		status = real32_call(PAGE0->mem_kbd.iodc_io,
			(unsigned long)PAGE0->mem_kbd.hpa, ENTRY_IO_CIN,
			PAGE0->mem_kbd.spa, __pa(PAGE0->mem_kbd.dp.layers),
			__pa(iodc_retbuf), 0, __pa(iodc_dbuf), 1, 0);
		restore_flags(flags);
		ch = *iodc_dbuf;	/* save the character directly to ch */
	} while (*iodc_retbuf == 0);	/* wait for a key */
	return ch;
}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:24,代码来源:pdc_cons.c


示例18: gs_flush_buffer

void gs_flush_buffer(struct tty_struct *tty)
{
	struct gs_port *port;
	unsigned long flags;

	func_enter ();

	if (!tty) return;

	port = tty->driver_data;

	if (!port) return;

	/* XXX Would the write semaphore do? */
	save_flags(flags); cli();
	port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
	restore_flags(flags);

	wake_up_interruptible(&tty->write_wait);
	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
	    tty->ldisc.write_wakeup)
		(tty->ldisc.write_wakeup)(tty);
	func_exit ();
}
开发者ID:froggatt,项目名称:edimax-br-6528n,代码行数:24,代码来源:generic_serial.c


示例19: skb_unlink

/*
 *	Remove an sk_buff from its list. Works even without knowing the list it
 *	is sitting on, which can be handy at times. It also means that THE LIST
 *	MUST EXIST when you unlink. Thus a list must have its contents unlinked
 *	_FIRST_.
 */
void skb_unlink(struct sk_buff *skb)
{
	unsigned long flags;

	save_flags(flags);
	cli();

	IS_SKB(skb);

	if(skb->list)
	{
		skb->list->qlen--;
		skb->next->prev = skb->prev;
		skb->prev->next = skb->next;
		skb->next = NULL;
		skb->prev = NULL;
		skb->list = NULL;
	}
#ifdef PARANOID_BUGHUNT_MODE	/* This is legal but we sometimes want to watch it */
	else
		printk("skb_unlink: not a linked element\n");
#endif
	restore_flags(flags);
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:30,代码来源:skbuff.c


示例20: M68EZ328_insert_irq

void M68EZ328_insert_irq(irq_node_t **list, irq_node_t *node)
{
	unsigned long flags;
	irq_node_t *cur;

	if (!node->dev_id)
		printk("%s: Warning: dev_id of %s is zero\n",
		       __FUNCTION__, node->devname);

	save_flags(flags);
	cli();

	cur = *list;

	while (cur) {
		list = &cur->next;
		cur = cur->next;
	}

	node->next = cur;
	*list = node;

	restore_flags(flags);
}
开发者ID:ya-mouse,项目名称:cnu-680pro,代码行数:24,代码来源:ints.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ save_image函数代码示例发布时间:2022-05-30
下一篇:
C++ save_file函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap