亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jit.c

?? 驅動程序第三版的示例源代碼,學驅動這個是必備的源代碼
?? C
字號:
/* * jit.c -- the just-in-time module * * Copyright (C) 2001,2003 Alessandro Rubini and Jonathan Corbet * Copyright (C) 2001,2003 O'Reilly & Associates * * The source code in this file can be freely used, adapted, * and redistributed in source or binary form, so long as an * acknowledgment appears in derived source files.  The citation * should list that the code comes from the book "Linux Device * Drivers" by Alessandro Rubini and Jonathan Corbet, published * by O'Reilly & Associates.   No warranty is attached; * we cannot take responsibility for errors or fitness for use. * * $Id: jit.c,v 1.16 2004/09/26 07:02:43 gregkh Exp $ */#include <linux/config.h>#include <linux/module.h>#include <linux/moduleparam.h>#include <linux/init.h>#include <linux/time.h>#include <linux/timer.h>#include <linux/kernel.h>#include <linux/proc_fs.h>#include <linux/types.h>#include <linux/spinlock.h>#include <linux/interrupt.h>#include <asm/hardirq.h>/* * This module is a silly one: it only embeds short code fragments * that show how time delays can be handled in the kernel. */int delay = HZ; /* the default delay, expressed in jiffies */module_param(delay, int, 0);MODULE_AUTHOR("Alessandro Rubini");MODULE_LICENSE("Dual BSD/GPL");/* use these as data pointers, to implement four files in one function */enum jit_files {	JIT_BUSY,	JIT_SCHED,	JIT_QUEUE,	JIT_SCHEDTO};/* * This function prints one line of data, after sleeping one second. * It can sleep in different ways, according to the data pointer */int jit_fn(char *buf, char **start, off_t offset,	      int len, int *eof, void *data){	unsigned long j0, j1; /* jiffies */	wait_queue_head_t wait;	init_waitqueue_head (&wait);	j0 = jiffies;	j1 = j0 + delay;	switch((long)data) {		case JIT_BUSY:			while (time_before(jiffies, j1))				cpu_relax();			break;		case JIT_SCHED:			while (time_before(jiffies, j1)) {				schedule();			}			break;		case JIT_QUEUE:			wait_event_interruptible_timeout(wait, 0, delay);			break;		case JIT_SCHEDTO:			set_current_state(TASK_INTERRUPTIBLE);			schedule_timeout (delay);			break;	}	j1 = jiffies; /* actual value after we delayed */	len = sprintf(buf, "%9li %9li\n", j0, j1);	*start = buf;	return len;}/* * This file, on the other hand, returns the current time forever */int jit_currentime(char *buf, char **start, off_t offset,                   int len, int *eof, void *data){	struct timeval tv1;	struct timespec tv2;	unsigned long j1;	u64 j2;	/* get them four */	j1 = jiffies;	j2 = get_jiffies_64();	do_gettimeofday(&tv1);	tv2 = current_kernel_time();	/* print */	len=0;	len += sprintf(buf,"0x%08lx 0x%016Lx %10i.%06i\n"		       "%40i.%09i\n",		       j1, j2,		       (int) tv1.tv_sec, (int) tv1.tv_usec,		       (int) tv2.tv_sec, (int) tv2.tv_nsec);	*start = buf;	return len;}/* * The timer example follows */int tdelay = 10;module_param(tdelay, int, 0);/* This data structure used as "data" for the timer and tasklet functions */struct jit_data {	struct timer_list timer;	struct tasklet_struct tlet;	int hi; /* tasklet or tasklet_hi */	wait_queue_head_t wait;	unsigned long prevjiffies;	unsigned char *buf;	int loops;};#define JIT_ASYNC_LOOPS 5void jit_timer_fn(unsigned long arg){	struct jit_data *data = (struct jit_data *)arg;	unsigned long j = jiffies;	data->buf += sprintf(data->buf, "%9li  %3li     %i    %6i   %i   %s\n",			     j, j - data->prevjiffies, in_interrupt() ? 1 : 0,			     current->pid, smp_processor_id(), current->comm);	if (--data->loops) {		data->timer.expires += tdelay;		data->prevjiffies = j;		add_timer(&data->timer);	} else {		wake_up_interruptible(&data->wait);	}}/* the /proc function: allocate everything to allow concurrency */int jit_timer(char *buf, char **start, off_t offset,	      int len, int *eof, void *unused_data){	struct jit_data *data;	char *buf2 = buf;	unsigned long j = jiffies;	data = kmalloc(sizeof(*data), GFP_KERNEL);	if (!data)		return -ENOMEM;	init_timer(&data->timer);	init_waitqueue_head (&data->wait);	/* write the first lines in the buffer */	buf2 += sprintf(buf2, "   time   delta  inirq    pid   cpu command\n");	buf2 += sprintf(buf2, "%9li  %3li     %i    %6i   %i   %s\n",			j, 0L, in_interrupt() ? 1 : 0,			current->pid, smp_processor_id(), current->comm);	/* fill the data for our timer function */	data->prevjiffies = j;	data->buf = buf2;	data->loops = JIT_ASYNC_LOOPS;		/* register the timer */	data->timer.data = (unsigned long)data;	data->timer.function = jit_timer_fn;	data->timer.expires = j + tdelay; /* parameter */	add_timer(&data->timer);	/* wait for the buffer to fill */	wait_event_interruptible(data->wait, !data->loops);	if (signal_pending(current))		return -ERESTARTSYS;	buf2 = data->buf;	kfree(data);	*eof = 1;	return buf2 - buf;}void jit_tasklet_fn(unsigned long arg){	struct jit_data *data = (struct jit_data *)arg;	unsigned long j = jiffies;	data->buf += sprintf(data->buf, "%9li  %3li     %i    %6i   %i   %s\n",			     j, j - data->prevjiffies, in_interrupt() ? 1 : 0,			     current->pid, smp_processor_id(), current->comm);	if (--data->loops) {		data->prevjiffies = j;		if (data->hi)			tasklet_hi_schedule(&data->tlet);		else			tasklet_schedule(&data->tlet);	} else {		wake_up_interruptible(&data->wait);	}}/* the /proc function: allocate everything to allow concurrency */int jit_tasklet(char *buf, char **start, off_t offset,	      int len, int *eof, void *arg){	struct jit_data *data;	char *buf2 = buf;	unsigned long j = jiffies;	long hi = (long)arg;	data = kmalloc(sizeof(*data), GFP_KERNEL);	if (!data)		return -ENOMEM;	init_waitqueue_head (&data->wait);	/* write the first lines in the buffer */	buf2 += sprintf(buf2, "   time   delta  inirq    pid   cpu command\n");	buf2 += sprintf(buf2, "%9li  %3li     %i    %6i   %i   %s\n",			j, 0L, in_interrupt() ? 1 : 0,			current->pid, smp_processor_id(), current->comm);	/* fill the data for our tasklet function */	data->prevjiffies = j;	data->buf = buf2;	data->loops = JIT_ASYNC_LOOPS;		/* register the tasklet */	tasklet_init(&data->tlet, jit_tasklet_fn, (unsigned long)data);	data->hi = hi;	if (hi)		tasklet_hi_schedule(&data->tlet);	else		tasklet_schedule(&data->tlet);	/* wait for the buffer to fill */	wait_event_interruptible(data->wait, !data->loops);	if (signal_pending(current))		return -ERESTARTSYS;	buf2 = data->buf;	kfree(data);	*eof = 1;	return buf2 - buf;}int __init jit_init(void){	create_proc_read_entry("currentime", 0, NULL, jit_currentime, NULL);	create_proc_read_entry("jitbusy", 0, NULL, jit_fn, (void *)JIT_BUSY);	create_proc_read_entry("jitsched",0, NULL, jit_fn, (void *)JIT_SCHED);	create_proc_read_entry("jitqueue",0, NULL, jit_fn, (void *)JIT_QUEUE);	create_proc_read_entry("jitschedto", 0, NULL, jit_fn, (void *)JIT_SCHEDTO);	create_proc_read_entry("jitimer", 0, NULL, jit_timer, NULL);	create_proc_read_entry("jitasklet", 0, NULL, jit_tasklet, NULL);	create_proc_read_entry("jitasklethi", 0, NULL, jit_tasklet, (void *)1);	return 0; /* success */}void __exit jit_cleanup(void){	remove_proc_entry("currentime", NULL);	remove_proc_entry("jitbusy", NULL);	remove_proc_entry("jitsched", NULL);	remove_proc_entry("jitqueue", NULL);	remove_proc_entry("jitschedto", NULL);	remove_proc_entry("jitimer", NULL);	remove_proc_entry("jitasklet", NULL);	remove_proc_entry("jitasklethi", NULL);}module_init(jit_init);module_exit(jit_cleanup);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩电影在线看| 欧美亚洲一区二区在线观看| 一区二区三区国产| 欧美mv日韩mv| 欧美日韩第一区日日骚| 国产综合色精品一区二区三区| 中文字幕成人网| 日韩欧美激情一区| 91精品国产综合久久久久久| 国产自产2019最新不卡| 国产无遮挡一区二区三区毛片日本| 国产成人av影院| 久久99国产精品麻豆| 国产精品不卡在线观看| 日韩欧美你懂的| 精品国产1区2区3区| 欧美天堂一区二区三区| 色综合中文字幕国产| 国产精品996| 国产一区二区精品久久91| 亚洲一区二区四区蜜桃| 亚洲永久精品大片| 亚洲第四色夜色| 亚洲午夜免费福利视频| 亚洲欧美国产三级| 亚洲精品日韩一| 午夜伊人狠狠久久| 亚洲不卡在线观看| 激情亚洲综合在线| 国产精品夜夜嗨| 国产精品亚洲а∨天堂免在线| 韩国av一区二区| 国产·精品毛片| 99久久夜色精品国产网站| 色先锋资源久久综合| 在线看不卡av| 日韩一区二区三区在线视频| 日韩一区国产二区欧美三区| 中文字幕免费不卡在线| 日韩三级在线免费观看| 精品国产髙清在线看国产毛片| 精品国产一区二区亚洲人成毛片| 欧美精品一区二区久久婷婷| 久久免费电影网| 亚洲精品美国一| 美女一区二区在线观看| 91丨九色porny丨蝌蚪| 欧美一区二区不卡视频| 亚洲人成在线播放网站岛国| 午夜久久久久久久久 | 一区二区三区不卡在线观看 | 艳妇臀荡乳欲伦亚洲一区| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产在线精品免费av| 欧美性色综合网| 成人免费在线视频观看| 亚洲成人av电影在线| 91天堂素人约啪| xvideos.蜜桃一区二区| 美女尤物国产一区| 色婷婷久久久综合中文字幕| 精品国产髙清在线看国产毛片| 一区二区国产视频| 色综合久久六月婷婷中文字幕| 欧美精品一区在线观看| 婷婷综合久久一区二区三区| 色噜噜狠狠成人中文综合| 欧美国产一区二区在线观看| 韩国成人福利片在线播放| 欧美日韩免费视频| 国产精品久久网站| 成人福利电影精品一区二区在线观看| 国产蜜臀av在线一区二区三区| 色999日韩国产欧美一区二区| 日日夜夜免费精品| 欧美国产日韩a欧美在线观看 | 欧美激情一区二区三区蜜桃视频| 在线观看av一区二区| 国产一区二区三区高清播放| 亚洲欧美日韩人成在线播放| 黄色小说综合网站| 日韩欧美国产一区二区在线播放| 午夜视频一区在线观看| 正在播放一区二区| 狠狠色丁香九九婷婷综合五月| 国产亚洲一二三区| 色欧美片视频在线观看在线视频| 亚洲精品免费在线观看| 欧美四级电影网| 精品一区二区免费看| 中文字幕的久久| 欧美三级韩国三级日本一级| 蜜桃视频第一区免费观看| 精品久久人人做人人爽| 91在线视频网址| 青青草国产精品亚洲专区无| 久久久www成人免费无遮挡大片| 东方欧美亚洲色图在线| 日韩有码一区二区三区| 久久免费电影网| 麻豆精品视频在线观看免费| 欧美美女一区二区在线观看| 国产精品美女久久久久aⅴ国产馆| 欧美色区777第一页| 在线免费一区三区| 欧美色窝79yyyycom| 亚洲国产中文字幕| 这里只有精品99re| 国产精品一二二区| 日韩精品一区在线观看| 91网上在线视频| 亚洲图片欧美一区| 国产精品久久夜| 国产拍欧美日韩视频二区| 欧美一级精品在线| 欧美人狂配大交3d怪物一区 | 麻豆精品视频在线观看视频| 亚洲国产综合在线| 一区av在线播放| 亚洲午夜一区二区三区| 亚洲一区二区av在线| 一区二区三区中文字幕| 亚洲摸摸操操av| 一本大道av一区二区在线播放| 国产毛片精品视频| 国产精品亚洲综合一区在线观看| 狠狠久久亚洲欧美| 国产精品一级黄| www..com久久爱| 91免费观看视频| 欧美最新大片在线看 | 亚洲综合在线视频| 亚洲狼人国产精品| 秋霞电影一区二区| 激情综合色丁香一区二区| 国产真实精品久久二三区| 成人美女在线视频| 日本二三区不卡| 6080日韩午夜伦伦午夜伦| 欧美va亚洲va香蕉在线| 国产欧美日韩在线视频| 亚洲视频1区2区| 老司机免费视频一区二区三区| 国产·精品毛片| 欧美日韩亚洲高清一区二区| 久久久91精品国产一区二区精品 | 成人av网址在线观看| 欧美在线三级电影| 国产午夜精品久久| 青娱乐精品视频| 日本韩国精品在线| 精品久久久网站| 天天av天天翘天天综合网| 成人一区在线观看| 日韩免费看网站| 亚洲一区二区3| 91在线无精精品入口| 国产欧美精品一区aⅴ影院| 日本一不卡视频| 777精品伊人久久久久大香线蕉| 欧美韩日一区二区三区| 激情丁香综合五月| 91精品国产综合久久香蕉麻豆| 亚洲日本在线观看| 欧美二区乱c少妇| 亚洲丝袜美腿综合| 99热精品一区二区| 国产精品萝li| 懂色av一区二区三区蜜臀| 久久综合九色综合97_久久久| 亚洲无人区一区| 欧美日韩国产精品成人| 亚洲第一福利一区| 欧美日韩国产影片| 亚洲第一狼人社区| 欧美二区三区的天堂| 日韩精品电影在线| 欧美不卡一区二区三区四区| 奇米色777欧美一区二区| 精品美女在线观看| 国产一区二区三区日韩 | 亚洲高清视频的网址| 欧美伦理电影网| 精品一区二区在线看| 久久久蜜桃精品| av中文字幕在线不卡| 亚洲777理论| 久久不见久久见免费视频7| 综合av第一页| 亚洲欧美另类小说| 欧美电影免费观看高清完整版在线 | 久久精品国产77777蜜臀| 亚洲三级在线免费观看| 国产亚洲va综合人人澡精品 | 日韩精品一区二区三区中文精品| www.一区二区| 国产·精品毛片| 国内精品免费在线观看| 日韩国产在线观看一区| 亚洲视频一区二区在线|