上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页
摘要: 在linux的shell中,输入输出分为3部分:标准输入(stdin):代码为0,使用<或<<标准输出(stdout):代码为1,使用>或>>标准错误输出(stderr):代码为2,使用2>或2>>标准输出(stdout): 这个比较容易懂,1> 或者 > -------- 覆盖的方法将正确的数据输出到指定的文件或设备上。1>>或者>> ------ 累加的方法...比如:cat file1 > file2标准错误输出(stderr): 类似的:2> ------- 覆盖的方法...2> 阅读全文
posted @ 2011-11-13 16:44 Jack204 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 你知道吗?我今天花了一天的时间,就是为了搞清楚linux中时间是从哪儿来的?都快哭了,它的时间咋就那么的乱呢?还有时钟中断,怎么说呢?与其看他的杂乱无章的代码,不如暂时的囫囵吞枣先以为自己理解了。等到以后有机会再细看kernel代码。开始时间之旅:硬件所提供的功能:RTC(Real Time Clock)--------The RTC continues to tick even when the PC is switched off, because it is energized by a small battery.Linux uses the RTC only to derive th 阅读全文
posted @ 2011-11-10 12:27 Jack204 阅读(1417) 评论(0) 推荐(0) 编辑
摘要: 一 。因为我是在写driver的时候,学会的这个问题,就以driver的代码来理解吧。 while (dev->rp == dev->wp) { /* nothing to read */ up(&dev->sem); /* release the lock */ if (filp->f_flags & O_NONBLOCK) return -EAGAIN; PDEBUG("\"%s\" reading: going to sleep\n", current-... 阅读全文
posted @ 2011-11-08 15:37 Jack204 阅读(1711) 评论(0) 推荐(0) 编辑
摘要: 1 不要谈论自己。。Don't talk about myself. 阅读全文
posted @ 2011-11-08 13:40 Jack204 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 如何将shell script功能模块化,并且对外留出函数和参数接口。要写出这种高质量的模块化的东西,需要对要写的这一块的业务非常理解,知道哪些是通用的,哪些是不通用的。从而将其分离,废话不多说直接看一个我感觉很牛B的脚本。以下脚本的作用:我新写了一个内核device driver模块,下面的脚本是尝试将我的模块,加载模块,在/dev目录下创建结点+++删除文件,卸载模块。参数接口部分:#!/bin/bash# Sample init script for the a driver module <rubini@linux.it>DEVICE="scull"SE 阅读全文
posted @ 2011-11-01 17:26 Jack204 阅读(1696) 评论(0) 推荐(0) 编辑
摘要: Quoting a single character with the backslashYou can prevent the shell from interpreting a character by placing a backslash ("\") in front of it. Here is a shell script that can delete any files that contain an asterisk:echo This script removes all files thatecho contain an asterisk in the 阅读全文
posted @ 2011-11-01 14:35 Jack204 阅读(518) 评论(0) 推荐(0) 编辑
摘要: 对于c的可重定位文件中的.symtab..symtab存放的是 全局变量/函数名字. --- 给连接器来使用symtab中每个条目都有自己的属性.所以static与非static的全局变量和函数名字都在.symtab中,在重定位之后才会被去除,不过static类型的定义,连接器不会把它往外部.链接但是虽然不往外部链接,用到函数名或者全局变量的地方,无论是否为static,都需要在链接时候进行重定位.!!!!!!!!!!!!!! 阅读全文
posted @ 2011-10-31 23:56 Jack204 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 首先必须明确,module生成的.ko文件中的全局变量,函数名在insmod之前还没有被重定位,也就是在加载的时候,才被分配了地址,进行了重定位。1 insmod rmmod时候,调用init, exit.使用宏module_init(init), module_exit(exit).导出,在加载模块的时候,重定位之后,kernel内模块的control block内就有这么2个函数指针变量*p_init, *p_exit分别用于存放init和exit的地址。这是动态生成的。 阅读全文
posted @ 2011-10-31 22:57 Jack204 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 主要的Makefile内容如下,非常的绕。 1 ifneq ($(KERNELRELEASE),) 2 # call from kernel build system 3 4 scull-objs := main.o pipe.o access.o 6 obj-m := scull.o 7 8 else 9 10 KERNELDIR ?= /lib/modules/$(shell uname -r)/build11 PWD := $(shell pwd)12 13 modules:14 $(MAKE) -C $(KERNELDIR) M=$(PWD) LDD... 阅读全文
posted @ 2011-10-31 19:42 Jack204 阅读(3437) 评论(0) 推荐(0) 编辑
摘要: DescriptionFor the purpose of performing permission checks, traditional Unix implementations distinguish two categories of processes: privileged processes (whose effective user ID is 0, referred to as superuser or root), and unprivileged processes (whose effective UID is non-zero). Privileged proces 阅读全文
posted @ 2011-10-31 14:51 Jack204 阅读(994) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页