易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux Kernel Threads in Device Drivers

 Purpose
This examples shows how to create and stop a kernel thread.
The driver is implemented as a loadable module. In the init_module() routine five kernel threads are created. This kernel threads sleep one second, wake up, print a message and fall asleep again. On unload of the module (cleanup_module), the kernel threads are killed.
The example has been tested with Linux kernel 2.4.2 on Intel (uni processor only) and Alpha platform (COMPAQ Personal Workstation 500au (uni processor), DS20 and ES40 (SMP).
A version for the 2.2 kernel can be found here. Note: depending on the context of the creator of the threads the new threads may inherit properties from the parent you do not want to have. The new version avoids this by having keventd create the threads. The 2.2. kernel do not have a keventd, so this approach is not implementable there.
Functions in example
    * start_kthread: creates a new kernel thread. Can be called from any process context but not from interrupt. The functions blocks until the thread started.
    * stop_kthread: stop the thread. Can be called from any process context but the thread to be terminated. Cannot be called from interrupt context. The function blocks until the thread terminated.
    * init_kthread: sets the environment of the new threads. Is to be called out of the created thread.
    * exit_kthread: needs to be called by the thread to be terminated on exit
Creation of new Thread
A new thread is created with kernel_thread(). The thread inherits properties from its parents. To make sure that we do not get any weired properties, we let keventd create the new thread.
The new thread is created with start_kthread(). It uses a semaphore to block until the new thread is running. A down() blocks the start_kthread() routine until the corresponding up() call in init_kthread() is executed.
The new thread must call init_kthread() in order to let the creator continue.


相关文档:

实战Linux Bluetooth编程(三) HCI层编程

1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI)  就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......

Linux平台下安装Apache (by quqi99)

       Linux平台下安装Apache (by quqi99)
 
作者:张华 发表于:2009-11-19
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明
 首先保证安装GCC与ZLIB
 安装ZLIB步骤:
1)./configure --prefix=/usr/zhang/zlib
2) make ......

Ubuntu Linux操作系统下好用的下载工具


用过 aMule 都知道,无论怎么设置,它的速度都不令人满意。那么在 Ubuntu 下除了 mldonkey 还有什么好用的驴子?答案是 wine+emule,不用怎么设置速度轻轻松松就能达到峰值。这么做可能一些 Linux 死忠们会不屑,但无可否认 emule 绝对比 amule 优秀,既然能用为什么不用呢?在 Windows 上我都还用 mplayer 呢。
在 Ubu ......

Linux系统的Shell I/O重定向详解

I/O重定向详解及应用实例
1、 基本概念(这是理解后面的知识的前提,请务必理解)
a、 I/O重定向通常与 FD有关,shell的FD通常为10个,即 0~9;
b、 常用FD有3个,为0(stdin,标准输入)、1(stdout,标准输出)、2(stderr,标准错误输出),默认与keyboard、monitor、monitor有关;
c、 用 < 来改变读进的数 ......

Linux下OpenEv编译安装

 把GDAL安装目录下的../bin/gdal-config复制到/usr/bin/下,否则出现“找不到gdal-config”
把proj4安装目录下的../include/proj_api.h复制到GDAL安装目录中的include中,否则出现“未定义proj_api.h”或者直接把proj4安装到默认路径,否则会提示“找不到 -lproj”。 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号