Пример #1
0
void compound_stmt(int level)
{
    int this_line = line_cnt;
    if(strcmp(tokenPos->textOfLine,"{") == 0)
    {
        push(LCGWAL, this_line);
        
        push_child(this_line,LOCDEC);
        local_dec(level+1);
        
        push_child(this_line,STMT);
        stmt_list(level+1);
        
		pTreeType[this_line][0] = COM_STMT;
        pTreeType[this_line][1] = level;

        if(strcmp(tokenPos->textOfLine,"}") != 0)
        {
            print_err(tokenPos->lineNum,tokenPos->textOfLine,"COMPOUND_STMT","}",tokenPos->tokenType);
            
        }
        else
        {
            push(RCGWAL, this_line);
            
        }
    }
}
Пример #2
0
int __init __module_ref_addr_init(void) 
{ 	
	local_t * addr;
	unsigned int cpu = get_cpu();  //获取当前cpu ID 

    	/*addr 为指向当前模块引用计数的指针*/
	addr = __module_ref_addr( THIS_MODULE, cpu ); 
	printk("<0>addr: %lx\n", (unsigned long)addr);	
	
	printk("<0>originally,\n");  //输出初始时当前模块的引用计数
	printk("<0>refs of this module is: %d\n",module_refcount(THIS_MODULE));
	
	local_inc(addr);  //实现将addr所指向的内容加1
	printk("<0>after calling local_inc,\n");  
	printk("<0>refs of this module is: %d\n",module_refcount(THIS_MODULE));	

	local_dec(addr);  //实现将addr所指向的内容减1
	printk("<0>after calling local_dec,\n");
	printk("<0>refs of this module is: %d\n",module_refcount(THIS_MODULE));

	put_cpu();  //允许抢占 preempt_enable( )

	return 0; 
}
Пример #3
0
static void uio_vma_close(struct vm_area_struct *vma)
{
    struct uio_device *idev = vma->vm_private_data;
    local_dec(&idev->vma_count);
}
Пример #4
0
static inline void _stp_ring_buffer_enable_cpu(void)
{
	local_dec(&__get_cpu_var(_stp_cpu_disabled));
	preempt_enable();
}