chennrui.blogspot.com
chenrui: study kernel(3) -- memory,vfs
http://chennrui.blogspot.com/2011/07/study-kernel3-memoryvfs.html
Study kernel(3) - memory,vfs. 1. 逻辑地址:每个逻辑地址都有一个段和偏移量组成,偏移量指明从段开始的地方到实际地址之间的距离。Linux中逻辑地址总是与线性地址一致。 2. 线性地址:虚拟地址。32位系统有4G的线性地址,64位系统有8G线性地址。 3. 物理地址:物理内存的实际地址。 页:线性地址被分成固定长度为单位的组。页内部连续的线性地址被映射到连续的物理地址中。页既指一组线性地址,又指这组地址中的数据。Linux每一页有4KB容量。 页框:或物理页。一个页框包含一个页,因此页框长度与页长度一致。页可存放在任何一个物理页中。页框就是物理内存。 内核中用页述符struct page描述每一个页框的状态信息,所有的页描述符都保存在mem map数组中。 Unsigned long flags; / 描述页框状态. Atomic t count; / 页框的引用计数. Atomic t mapcount; / 页框中页表数目. Void *virtual; / 页框的虚拟地址. Slab的使用:(struct task struct). Linux操作系统采用虚拟内存管理...
chennrui.blogspot.com
chenrui: 一月 2011
http://chennrui.blogspot.com/2011_01_01_archive.html
The relationship between pad and caps. Name template(eg:wavparse src, wavparse sink) -direction(src or sink) GstStaticPadTemplate- -presence(Sometimes, Always, request) -GstCaps(String is stored in GstStruct) -GstStaticCaps- - -String(support caps) gst static pad template get() -GstObject V GstPadTemplate- - - -direction -presence -GstCaps gst pad new from static template() V -GstObject GstPad- - - - -GstPadTemplate . Add pad into element and set relation. Set pad active from srcpad to sinkpad. GST STATE...
chennrui.blogspot.com
chenrui: tcpip stack(2) -- L3 send and receve
http://chennrui.blogspot.com/2011/08/tcpip-stack2-l3-send-and-receve.html
Tcpip stack(2) - L3 send and receve. Struct msghdr 保存数据。在. Struct sk buff 保存数据,这个结构被整个网络协议栈使用,如. UDP 等。并且其中的成员变量在结构从一层向另一层传递时解析本层的数据头。 Ip router output flow 根据saddr和daddr在rt hash table中查找路由表。 如果没有找到则查找fib,并 mkroute output创建struct rtable。将rtable加入rt hash table. Neigh create:根据rtable- dst entry创建struct neigh邻居,设置定时操作neigh timer handler,. Ip append data 将大数据分片,创建struct sk buffer,并将其加入struct sk- sk write queue. Ip push pending frames. Ip finish skb 构造ip头. Ip finish output 如果在hh cache中找到daddr信息则将数据传到driver.
chennrui.blogspot.com
chenrui: study kernel(2) -- sync, interrupt
http://chennrui.blogspot.com/2011/07/study-kernel2-sync-interrupt.html
Study kernel(2) - sync, interrupt. Linux提供了一系列C语言函数来实现内核中的原子操作,这些函数又分为两类,分别针对bit变量和整数变量进行原子操作。它们的共同点是在任何情况下都是原子的,内核代码可以安全的调用它们而不被中断,而且它们都依赖底层CPU的原子操作来实现-所有这些函数都是CPU架构相关的。其实现在atomic.h和bitops.h中. CPU具备屏蔽中断和打开中断的功能,这项功能可以保证正在执行的内核控制路径不被中断处理程序所抢占,防止某些竞争条件的发生。Linux提供了local irq disable()/local irq enable(),local irq save()/local irq restone()来实现屏蔽/开启中断的功能。 信号量为了解决多个内核控制路径竞争资源的问题,这些内核控制路径可能是单处理器系统中分时执行的控制路径,也可能是多处理器系统中的并行执行的控制路径。在试图获得信号量的时候,如果信号量繁忙,相应的内核控制路径会挂起,直到信号量被释放...A 代码量应越少越好,以便中断函数的快速执行。 上述两个条件中,...
chennrui.blogspot.com
chenrui: tcpip stack(1) -- init
http://chennrui.blogspot.com/2011/07/tcpip-stack1-init.html
Tcpip stack(1) - init. Static struct vfsmount *sock mnt read mostly;. Static int init sock init(void). Skb init(); / 为socket buffer创建高速缓存. Init inodecache(); / 为struct sock alloc创建高速缓存. Register filesystem(&sock fs type);. Sock mnt = kern mount(&sock fs type);. Static struct file system type sock fs type = {. Name = "sockfs",. Mount = sockfs mount,. Kill sb = kill anon super,. Static struct file system type *file systems;. Int register filesystem(struct file system type * fs). Struct file system type * p;.
chennrui.blogspot.com
chenrui: 十二月 2010
http://chennrui.blogspot.com/2010_12_01_archive.html
Man trap, trap - help都没有,网上搜到格式如下:. Trap "echo "hello world "; echo $1". 额。。。没反应! 原来kill 命令发出信号SIGTERM,如果想用SIGKILL需要执行kill -9。 Trap为信号捕捉器,当接收到指定信号后执行" 中的命令。 1 想查看当前文件夹及子文件夹里有没有文件名为“abc”的文件. 2 想查看当前文件夹及子文件夹里有没有”xyz”目录. Find -type d -name xyz. Type:表示设定类型,d表示文件夹类型,可以替换为f(普通文件)、l(链接文件). 3 想找出当前文件夹及子文件夹里所有后缀是”.txt”的文件. Find -name “*.txt”. 4 想查找当前目录及其子文件夹中“roc”用户自己的文件有哪些. User:用于设定所属用户的名称,此处可替换为-group,即所属用户组的名称. Find -regex ‘.*b.*3′. 7 如果想全部输出用find命令查找出的”*.abc”文件的内容. 输出/tmp/code中所有.h,.c文件长度的总和. Eeese 23 22 fg...
chennrui.blogspot.com
chenrui: iptables command and rules
http://chennrui.blogspot.com/2011/05/iptables-command-and-rules.html
Iptables command and rules. Iptables [-t table] command [match] [target]. Iptables有5个链:PREROUTING,INPUT,FORWARD,OUTPUT,POSTROUTING;4个表:filter,nat,magle,raw. 4个表的优先级由高到低为:raw- mangle- nat- filter. 选项允许使用标准表之外的任何表。表是包含仅处理特定类型信息包的规则和链的信息包过滤表。该选项不是必需的,如果未指定, 则. 65306;表用于一般的信息包过滤。包括链表:. 65306; 用于转发,与nat table 相关性较高。 65306;主要在进行来源与目的之 IP 或 port 的转换,与 Linux 本机较无关,主要与 Linux 主机后的区域网路内电脑较有相关。包括链表:. 訂閱: 張貼留言 (Atom). Iptables command and rules. Time in Linux programming. Run Android Java console program.
chennrui.blogspot.com
chenrui: 八月 2011
http://chennrui.blogspot.com/2011_08_01_archive.html
Tcpip stack(2) - L3 send and receve. Struct msghdr 保存数据。在. Struct sk buff 保存数据,这个结构被整个网络协议栈使用,如. UDP 等。并且其中的成员变量在结构从一层向另一层传递时解析本层的数据头。 Ip router output flow 根据saddr和daddr在rt hash table中查找路由表。 如果没有找到则查找fib,并 mkroute output创建struct rtable。将rtable加入rt hash table. Neigh create:根据rtable- dst entry创建struct neigh邻居,设置定时操作neigh timer handler,. Ip append data 将大数据分片,创建struct sk buffer,并将其加入struct sk- sk write queue. Ip push pending frames. Ip finish skb 构造ip头. Ip finish output 如果在hh cache中找到daddr信息则将数据传到driver.
chennrui.blogspot.com
chenrui: 二月 2011
http://chennrui.blogspot.com/2011_02_01_archive.html
2月11日,NOKIA宣布,与微软达成广泛战略合作关系,并将Windows Phone作为其主要的智能手机操作系统。并且MeeGo和移动解决方案业务主管阿尔伯托·托雷斯(Alberto Torres)已经于2月10日离职。 同时有消息,首款MeeGo系统手机Nokia N9-00也不幸夭折。传说中的MeeGo,被视为诺基亚在高端智能手机市场上对抗苹果和谷歌的利器,看来大势已去。不知Intel有何感想,怀胎10月,流产了。 Tieto,跟在Nokia后的小弟,你又何去何从?!。。。命运掌握在自己手中睡觉才踏实,觉醒吧。 訂閱: 文章 (Atom). Time in Linux programming. Run Android Java console program. Chennrui. Watermark範本. 由 Blogger.
chennrui.blogspot.com
chenrui: study kernel(1) -- process, schedule
http://chennrui.blogspot.com/2011/07/study-kernel1-process-schedule.html
Study kernel(1) - process, schedule. Task struct 定义如下:. Struct task struct {. Volatile long state; / 进程运行状态. Struct thread info; / 线程描述符. Struct mm struct; / 描述内存存储信息. Struct tty struct; / 与进程相关的tty. Struct fs struct; / 当前目录. Struct signal struct; / 所接收的信号. 1. TASK RUNNING:进程正在执行或是可执行的,调度器可将其加入运行队列(runqueue)。 3. EXIT ZOMBIE:进程已经结束,但此时任占用内核栈、thread info、task struct,为了向父进程提供信息。当父进程调用了wait4()后,信息会被释放。 4. TASK STOPPED:进程停止运行。 Asmlinkage int sys fork(struct pt regs regs). Struct pt regs regs;. 普通进程通过静态优先级nice...