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

linux驱动之mmap实例

// Linux Device Driver Template/Skeleton with mmap
// Kernel Module
#include <linux/module.h>
#include <linux/init.h>
#include <linux/version.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <linux/vmalloc.h>
#include <linux/mman.h>
#include <linux/slab.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
#include <linux/wrapper.h>
#endif
#define SKELETON_MAJOR 240
#define SKELETON_NAME "skeleton"
#define CASE1 1
#define CASE2 2
static unsigned int counter = 0;
static char string [128];
static int data;
//#define USEASCII
#ifdef USEASCII
static char *kmalloc_area = NULL;
static char *kmalloc_ptr = NULL;
#else
static unsigned int *kmalloc_area = NULL;
static unsigned int *kmalloc_ptr = NULL;
#endif
#define LEN (64*1024)
unsigned long virt_addr;
DECLARE_WAIT_QUEUE_HEAD(skeleton_wait);
static int data_not_ready = 0;
// open function - called when the "file" /dev/skeleton is opened in userspace
static int skeleton_open (struct inode *inode, struct file *file) {
 printk("skeleton_openn");
 // we could do some checking on the flags supplied by "open"
 // i.e. O_NONBLOCK
 // -> set some flag to disable interruptible_sleep_on in skeleton_read
 return 0;
}
// close function - called when the "file" /dev/skeleton is closed in userspace 
static int skeleton_release (struct inode *inode, struct file *file) {
 printk("skeleton_releasen");
 return 0;
}
// read function called when from /dev/skeleton is read
static ssize_t skeleton_read (struct file *file, char *buf,
  size_t count, loff_t *ppos) {
 int len, err;
 
 // check if we have data - if not, sleep
 // wake up in interrupt_handler
 while (data_not_ready) {
  interrupt


相关文档:

Linux中find命令

 
在Windows中可以在某些路径中查找文件,也可以设定不在某些路径中查找文件,下面用Linux中的find的命令结合其-path -prune参数来看看在Linux中怎么实现此功能。
假如在当前目录下查找文件,且当前目录下有很多文件及目录(多层目录),包括dir0、dir1和dir2 ...等目录及dir00、dir01...dir10、dir11...等子目录。 ......

linux ping 命令详解





功能说明:检测主机。
语  法:ping
[-dfnqrRv][-c<完成次数>][-i<间隔秒数>][-I<网络界面>][-l<前置载
入>][-p<范本样式>][-s<数据包大小>][-t<存活数值>][主机名称或IP地址]
补充说明:执行ping指令会使用ICMP传输协议,发出要求回应的 ......

Linux多线程编程

Linux
多线程编程:【
http://fanqiang.chinaunix.net/a4/b8/20010811/0905001105.html

    
Linux
多线程支持
POSIX
线程接口,称为
pthread,
    
pthread_create
用来创建线程,
pthread_join
等待线程结束,函数的原型分别如下:
 
  &nbs ......

调整linux虚拟机硬盘大小

安装时硬盘空间不足
    挂载一个新硬盘
    先将虚拟机Power Off,在Virtual Machine Setting对话框里点击左下角的“Add”,选择“Hard Disk”,之后选择“Create a new virtual disk”,分配容量,其他默认配置。
    启动虚拟机系统,用 ......

Socket编程:由Linux向Windows移植问题


转自:http://www.cic.tsinghua.edu.cn/jdx/book1/CHAPTER3.htm
 
在源文件开始增加#include <winsock.h>语句。
调用WSAStartup()函数初始化Windows Sockets DLL,并在结束时调用WSACleanup()函数通知Windows Sockets DLL释放资源。
将套接字的类型为int改为SOCKET。
获取、设置错误码不要使用全局变量er ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号