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

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

?? jiq.c

?? linux設備驅動第二版例子程序
?? C
字號:
/* * jiq.c -- the just-in-queue module * * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet * Copyright (C) 2001 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: jiq.c,v 1.15 2001/07/18 22:28:16 rubini Exp $ */ /* BUGS: the module is not reentrant: only one file can be read at a time *       the module usage count is not used: you could remove the module *           while reading it, thus asking for troubles. */#ifndef __KERNEL__#  define __KERNEL__#endif#ifndef MODULE#  define MODULE#endif#include <linux/config.h>#include <linux/module.h>#include <linux/sched.h>#include <linux/kernel.h>#include <linux/fs.h>     /* everything... */#include <linux/proc_fs.h>#include <linux/errno.h>  /* error codes */#include <linux/tqueue.h>#include <linux/interrupt.h> /* intr_count */#include "sysdep.h"/* * This module is a silly one: it only embeds short code fragments * that show how enqueued tasks `feel' theit environment */#define LIMIT (PAGE_SIZE-128) /* don't print any more after this size *//* * Print information about the current environment. This is called from * within the task queues. If the limit is reched, awake the reading * process. */DECLARE_WAIT_QUEUE_HEAD (jiq_wait);struct tq_struct jiq_task; /* global: initialized to zero *//* * Keep track of info we need between task queue runs. */struct clientdata {    int len;    char *buf;    unsigned long jiffies;    task_queue *queue;} jiq_data;#define SCHEDULER_QUEUE ((task_queue *) 1)#ifdef HAVE_TASKLETSvoid jiq_print_tasklet (unsigned long);DECLARE_TASKLET (jiq_tasklet, jiq_print_tasklet, (unsigned long) &jiq_data);#endif /* HAVE_TASKLETS *//* * Do the printing; return non-zero if the task should be rescheduled. */int jiq_print(void *ptr){  struct clientdata *data = (struct clientdata *)ptr;  int len = data->len;  char *buf = data->buf;  unsigned long j = jiffies;  if (len > LIMIT) {       wake_up_interruptible(&jiq_wait);      return 0;  }  if (len == 0)      len = sprintf(buf,"    time  delta interrupt  pid cpu command\n");  else      len =0;  /* intr_count is only exported since 1.3.5, but 1.99.4 is needed anyways */  len += sprintf(buf+len,"%9li %3li        %i   %5i %3i %s\n",                 j, j - data->jiffies,                 in_interrupt (), current->pid, smp_processor_id (), current->comm);  data->len += len;  data->buf += len;  data->jiffies = j;  return 1;}/* * Call jiq_print from a task queue */void jiq_print_tq(void *ptr){    if (jiq_print (ptr)) {        struct clientdata *data = (struct clientdata *)ptr;        if (data->queue == SCHEDULER_QUEUE)	    schedule_task(&jiq_task);        else if (data->queue)            queue_task(&jiq_task, data->queue);        if (data->queue == &tq_immediate)            mark_bh(IMMEDIATE_BH); /* this one needs to be marked */    }}/* * Use the scheduler queue  -- /proc/jiqsched */int jiq_read_sched(char *buf, char **start, off_t offset,                   int len, int *eof, void *data){    jiq_data.len = 0;               /* nothing printed, yet */    jiq_data.buf = buf;             /* print in this place */    jiq_data.jiffies = jiffies;     /* initial time */    /* jiq_print will queue_task() again in jiq_data.queue */    jiq_data.queue = SCHEDULER_QUEUE;    schedule_task(&jiq_task);             /* ready to run */    interruptible_sleep_on(&jiq_wait);    /* sleep till completion */    *eof = 1;    return jiq_data.len;}#ifdef USE_PROC_REGISTERstatic int jiq_old_read_sched(char *buf, char **start, off_t offset, int len,                int unused){    int eof;    return jiq_read_sched(buf, start, offset, len, &eof, NULL);}struct proc_dir_entry jiq_proc_sched = {        0,                 /* low_ino: the inode -- dynamic */        8, "jiqsched",     /* len of name and name */        S_IFREG | S_IRUGO, /* mode */        1, 0, 0,           /* nlinks, owner, group */        0, NULL,           /* size - unused; operations -- use default */        &jiq_old_read_sched,   /* function used to read data */        /* nothing more */    };#endifint jiq_read_timer(char *buf, char **start, off_t offset,                   int len, int *eof, void *data){    jiq_data.len = 0;            /* nothing printed, yet */    jiq_data.buf = buf;          /* print in this place */    jiq_data.jiffies = jiffies;  /* initial time */    jiq_data.queue = &tq_timer;  /* re-register yourself here */    queue_task(&jiq_task, &tq_timer);     /* ready to run */    interruptible_sleep_on(&jiq_wait);    /* sleep till completion */    *eof = 1;    return jiq_data.len;}#ifdef USE_PROC_REGISTERstatic int jiq_old_read_timer(char *buf, char **start, off_t offset, int len,                int unused){    int eof;    return jiq_read_timer(buf, start, offset, len, &eof, NULL);}struct proc_dir_entry jiq_proc_timer = {        0,                 /* low_ino: the inode -- dynamic */        8, "jiqtimer",     /* len of name and name */        S_IFREG | S_IRUGO, /* mode */        1, 0, 0,           /* nlinks, owner, group */        0, NULL,           /* size - unused; operations -- use default */        &jiq_old_read_timer,   /* function used to read data */        /* nothing more */    };#endifint jiq_read_immed(char *buf, char **start, off_t offset,                   int len, int *eof, void *data){    jiq_data.len = 0;                /* nothing printed, yet */    jiq_data.buf = buf;              /* print in this place */    jiq_data.jiffies = jiffies;      /* initial time */    jiq_data.queue = &tq_immediate;  /* re-register yourself here */    queue_task(&jiq_task, &tq_immediate); /* ready to run */    mark_bh(IMMEDIATE_BH);    interruptible_sleep_on(&jiq_wait);    /* sleep till completion */    *eof = 1;    return jiq_data.len;}#ifdef USE_PROC_REGISTERstatic int jiq_old_read_immed(char *buf, char **start, off_t offset, int len,                int unused){    int eof;    return jiq_read_immed(buf, start, offset, len, &eof, NULL);}struct proc_dir_entry jiq_proc_immed = {        0,                 /* low_ino: the inode -- dynamic */        8, "jiqimmed",     /* len of name and name */        S_IFREG | S_IRUGO, /* mode */        1, 0, 0,           /* nlinks, owner, group */        0, NULL,           /* size - unused; operations -- use default */        &jiq_old_read_immed,   /* function used to read data */        /* nothing more */    };#endif#ifdef HAVE_TASKLETS/* * Call jiq_print from a tasklet */void jiq_print_tasklet(unsigned long ptr){    if (jiq_print ((void *) ptr))        tasklet_schedule (&jiq_tasklet);}int jiq_read_tasklet(char *buf, char **start, off_t offset, int len,                int *eof, void *data){    jiq_data.len = 0;                /* nothing printed, yet */    jiq_data.buf = buf;              /* print in this place */    jiq_data.jiffies = jiffies;      /* initial time */    tasklet_schedule(&jiq_tasklet);    interruptible_sleep_on(&jiq_wait);    /* sleep till completion */    *eof = 1;    return jiq_data.len;}/* No PROC_REGISTER junk since tasklets postdate all that */#endif /* HAVE_TASKLETS *//* * This one, instead, tests out the timers. */struct timer_list jiq_timer;void jiq_timedout(unsigned long ptr){    jiq_print((void *)ptr);            /* print a line */    wake_up_interruptible(&jiq_wait);  /* awake the process */}int jiq_read_run_timer(char *buf, char **start, off_t offset,                   int len, int *eof, void *data){    jiq_data.len = 0;           /* prepare the argument for jiq_print() */    jiq_data.buf = buf;    jiq_data.jiffies = jiffies;    jiq_data.queue = NULL;      /* don't requeue */    init_timer(&jiq_timer);              /* init the timer structure */    jiq_timer.function = jiq_timedout;    jiq_timer.data = (unsigned long)&jiq_data;    jiq_timer.expires = jiffies + HZ; /* one second */    jiq_print(&jiq_data);   /* print and go to sleep */    add_timer(&jiq_timer);    interruptible_sleep_on(&jiq_wait);    del_timer_sync(&jiq_timer);  /* in case a signal woke us up */        *eof = 1;    return jiq_data.len;}#ifdef USE_PROC_REGISTERstatic int jiq_old_read_run_timer(char *buf, char **start, off_t offset, int len,                int unused){    int eof;    return jiq_read_run_timer(buf, start, offset, len, &eof, NULL);}struct proc_dir_entry jiq_proc_run_timer = {        0,                 /* low_ino: the inode -- dynamic */        7, "jitimer",      /* len of name and name */        S_IFREG | S_IRUGO, /* mode */        1, 0, 0,           /* nlinks, owner, group */        0, NULL,           /* size - unused; operations -- use default */        &jiq_old_read_run_timer, /* function used to read data */        /* nothing more */    };#endif/* * the init/clean material */int jiq_init(void){    /* these lines are in jiq_init() */    jiq_task.routine = jiq_print_tq;    jiq_task.data = (void *)&jiq_data;#ifdef USE_PROC_REGISTER    proc_register_dynamic(&proc_root, &jiq_proc_sched);    proc_register_dynamic(&proc_root, &jiq_proc_timer);    proc_register_dynamic(&proc_root, &jiq_proc_immed);    proc_register_dynamic(&proc_root, &jiq_proc_run_timer);#else    create_proc_read_entry("jiqsched", 0, NULL, jiq_read_sched, NULL);    create_proc_read_entry("jiqtimer", 0, NULL, jiq_read_timer, NULL);    create_proc_read_entry("jiqimmed", 0, NULL, jiq_read_immed, NULL);    create_proc_read_entry("jitimer", 0, NULL, jiq_read_run_timer, NULL);#ifdef HAVE_TASKLETS    create_proc_read_entry("jiqtasklet", 0, NULL, jiq_read_tasklet, NULL);#endif#endif#ifndef JIT_DEBUG    EXPORT_NO_SYMBOLS;#endif    return 0; /* succeed */}void jiq_cleanup(void){#ifdef USE_PROC_REGISTER    proc_unregister(&proc_root, jiq_proc_sched.low_ino);    proc_unregister(&proc_root, jiq_proc_timer.low_ino);    proc_unregister(&proc_root, jiq_proc_immed.low_ino);    proc_unregister(&proc_root, jiq_proc_run_timer.low_ino);#else    remove_proc_entry("jiqsched", 0);    remove_proc_entry("jiqtimer", 0);    remove_proc_entry("jiqimmed", 0);    remove_proc_entry("jitimer", 0);#ifdef HAVE_TASKLETS    remove_proc_entry("jiqtasklet", 0);#endif#endif}module_init(jiq_init);module_exit(jiq_cleanup);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美午夜在线观看| 亚洲欧美另类小说视频| 中文字幕一区在线观看| 奇米777欧美一区二区| 久久久久久毛片| 亚洲资源中文字幕| a在线欧美一区| 欧美不卡激情三级在线观看| 依依成人精品视频| av在线综合网| 国产亚洲精品aa| 久久99这里只有精品| 91精品国产综合久久精品性色| 中文字幕一区免费在线观看| 激情文学综合插| 日韩免费一区二区三区在线播放| 午夜婷婷国产麻豆精品| 91成人网在线| 亚洲一区成人在线| 欧美色图12p| 亚洲女与黑人做爰| 91视视频在线观看入口直接观看www | 午夜精品国产更新| 94-欧美-setu| 亚洲色图都市小说| av电影一区二区| 日韩毛片视频在线看| 不卡视频免费播放| 国产精品美女久久久久久2018| 国产福利一区二区三区视频在线| 精品欧美久久久| 国产麻豆视频一区| 国产区在线观看成人精品| 国产精品系列在线播放| 国产视频一区不卡| 成a人片国产精品| 一区二区三区在线播放| 欧美色精品在线视频| 午夜视频一区在线观看| 日韩一级黄色大片| 国产美女精品在线| 中文字幕在线不卡国产视频| 色欲综合视频天天天| 夜夜嗨av一区二区三区四季av| 欧美日韩免费高清一区色橹橹| 日韩高清国产一区在线| 精品剧情在线观看| 处破女av一区二区| 一区二区三区四区国产精品| 欧美日韩日日夜夜| 国产精品一二三区在线| 亚洲欧美色综合| 欧美美女一区二区| 国产麻豆视频一区二区| 成人欧美一区二区三区1314 | 亚洲一区二区欧美| 欧美成人aa大片| 97国产精品videossex| 亚洲成人av一区二区| 精品伦理精品一区| 色偷偷88欧美精品久久久| 日韩高清电影一区| 国产精品午夜免费| 欧美日高清视频| 国产99久久久精品| 成人av网址在线| 亚洲制服欧美中文字幕中文字幕| 日韩免费电影一区| 色婷婷av一区二区三区大白胸| 日韩精品1区2区3区| 国产精品国产三级国产aⅴ中文| 欧美巨大另类极品videosbest | 在线免费视频一区二区| 裸体一区二区三区| 综合久久一区二区三区| 日韩一级二级三级| 在线观看日韩精品| 国产成人一区在线| 蜜臀久久久久久久| 一区二区三区在线影院| 精品国产一区二区三区忘忧草| 色菇凉天天综合网| 国产999精品久久| 久久99精品国产麻豆婷婷| 亚洲人成电影网站色mp4| 26uuu色噜噜精品一区| 欧美性做爰猛烈叫床潮| 成人精品电影在线观看| 精品在线免费观看| 石原莉奈在线亚洲二区| 亚洲欧美日本韩国| 中文字幕不卡一区| 精品动漫一区二区三区在线观看| 欧美日韩另类国产亚洲欧美一级| aaa欧美大片| 成人国产电影网| 国产精品一区二区你懂的| 日产精品久久久久久久性色| 亚洲综合无码一区二区| 亚洲日本va午夜在线影院| 欧美激情在线一区二区三区| 日韩精品一区二区三区蜜臀| 91精品国产综合久久蜜臀| 欧美视频一区在线| 欧美日韩一级二级三级| 欧美调教femdomvk| 色哟哟亚洲精品| 波多野洁衣一区| 成人国产精品免费观看视频| 成人做爰69片免费看网站| 国产精品一卡二卡在线观看| 紧缚奴在线一区二区三区| 另类综合日韩欧美亚洲| 激情成人综合网| 国产在线精品一区二区不卡了 | 麻豆国产精品一区二区三区| 香蕉影视欧美成人| 天天色 色综合| 日本不卡视频在线| 精品在线播放午夜| 国产一二三精品| 成人影视亚洲图片在线| 成人午夜精品一区二区三区| 成人h动漫精品一区二| 成人18精品视频| 在线影视一区二区三区| 欧美亚洲丝袜传媒另类| 欧美探花视频资源| 日韩一级免费观看| 国产网站一区二区| 亚洲日本电影在线| 午夜国产精品一区| 久久99精品一区二区三区三区| 久久国产尿小便嘘嘘| 国产乱国产乱300精品| 国产精品2024| 91精品国产综合久久久久| 久久人人超碰精品| 一区二区三区中文免费| 日韩激情av在线| 国产寡妇亲子伦一区二区| 成人黄色一级视频| 欧美日韩精品一区视频| 欧美r级电影在线观看| 国产精品久久一级| 日韩精品久久久久久| 国产精品一二三在| 欧美日韩亚洲综合| 国产农村妇女精品| 亚洲一区中文在线| 国产成人亚洲综合a∨婷婷| 91热门视频在线观看| 欧美一级久久久| 亚洲欧洲日产国码二区| 日韩av网站在线观看| 丁香激情综合五月| 制服丝袜亚洲色图| 亚洲欧美综合色| 另类欧美日韩国产在线| 色av综合在线| 久久久夜色精品亚洲| 亚洲h精品动漫在线观看| 成人一道本在线| 日韩欧美的一区| 一区二区三区.www| 成人涩涩免费视频| 精品精品欲导航| 一区二区三区av电影| 福利一区二区在线| 在线综合视频播放| 亚洲午夜一区二区| 99精品久久免费看蜜臀剧情介绍| 日韩欧美三级在线| 日韩精品乱码免费| 91国偷自产一区二区三区观看| 久久久久久免费网| 玖玖九九国产精品| 欧美日韩国产小视频在线观看| 自拍偷拍亚洲激情| 国产福利一区在线| 久久久久久日产精品| 另类小说欧美激情| 欧美一区二区三区白人| 亚洲在线免费播放| 色偷偷久久一区二区三区| 国产精品国产三级国产aⅴ无密码| 精品一区二区三区在线观看国产 | av在线不卡观看免费观看| 日韩欧美国产系列| 日本不卡的三区四区五区| 欧美日韩精品一区二区三区蜜桃| 亚洲女厕所小便bbb| eeuss鲁片一区二区三区在线看| 久久免费视频色| 国产精品自拍三区| 精品国产伦一区二区三区免费| 秋霞影院一区二区| 日韩欧美久久一区| 韩国视频一区二区| 国产欧美日本一区二区三区|