#include <sys/types.h> #include <sys/socket.h> int listen(int sockfd, int backlog); 描述: listen() marks the socket referred to by sockfd as a passive s Read More
posted @ 2016-07-17 13:34 suonikeyinsu Views(220) Comments(0) Diggs(0) Edit
#include <sys/types.h> #include <sys/socket.h> int socket(int domain, int type, int protocol); 返回值: On success, a file descriptor for the new socket i Read More
posted @ 2016-07-17 13:30 suonikeyinsu Views(295) Comments(0) Diggs(0) Edit
#include <sys/types.h> #include <sys/socket.h> int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); 返回值: On success, zero is returned Read More
posted @ 2016-07-17 13:26 suonikeyinsu Views(273) Comments(0) Diggs(0) Edit
设备模型的基础是kobject,kset,kobj_type。kobject本身并没有什么意义,真正有用的地方在于嵌入了kobject的结构体(对象),kobject可以看成是一个最小单元,sysfs的层次结构中的元素都是由kobject构成。kset与kobject的关系:kset会包含一类的ko... Read More
posted @ 2015-12-18 00:05 suonikeyinsu Views(588) Comments(0) Diggs(0) Edit
Everything you never wanted to know about kobjects, ksets, and ktypesGreg Kroah-Hartman Based on an original article by Jon Corbet for lwn.net written... Read More
posted @ 2015-12-17 23:55 suonikeyinsu Views(521) Comments(0) Diggs(0) Edit
内核模块的热插拔事件的通知基于uevent机制。当kobject的状态发生改变(如,add, remove等)时,会通知用户空间,用户空间接收到事件通知后可以做相应的处理。uevent把事件上报给用户空间的两种途径: 1.通过kmod模块,直接调用用户空间的可执行程序或脚本。 2.通过netli... Read More
posted @ 2015-12-17 23:39 suonikeyinsu Views(6185) Comments(0) Diggs(0) Edit
linux/arch/arm/kernel/call.S...CALL(sys_read)CALL(sys_write)CALL(sys_open)CALL(sys_close)...以read,write接口举栗子:linux/fs/read_write.cSYSCALL_DEFINE3(read... Read More
posted @ 2015-12-14 00:19 suonikeyinsu Views(661) Comments(0) Diggs(0) Edit
linux-3.5/arch/arm/include/asm/unistd.h#define __NR_OABI_SYSCALL_BASE 0x900000#define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE//提供给应用层使用#define __NR_r... Read More
posted @ 2015-12-14 00:15 suonikeyinsu Views(880) Comments(0) Diggs(0) Edit
.align的作用是针对指令或数据的存放地址对齐。但不同的CPU架构,指令和数据的存储方式不同,也就导致对齐的计量单位不一样。i386:n对齐ARM:2^n 对齐,ARM架构下,指令都是占32位,所以是4字节对齐。当数据没有4字节对齐,编译器会报错(arm-linux-gcc (ctng-1.8.1... Read More
posted @ 2015-12-12 00:09 suonikeyinsu Views(386) Comments(0) Diggs(0) Edit
内核模块可以使用两种方式加入进内核:1.使用insmod等命令动态加载到内核(obj-m);2.作为内核的一部分静态编译进内核(obj-y);在linux/init.h文件中typedef int (*initcall_t)(void);typedef void (*exitcall_t)(void... Read More
posted @ 2015-12-09 15:32 suonikeyinsu Views(322) Comments(0) Diggs(0) Edit