- 博客(10)
- 收藏
- 关注
转载 深入分析Linux自旋锁
转载:http://blog.chinaunix.net/uid-20543672-id-3252604.html 作者:Tekkaman Ninja
2015-06-18 11:29:45 470
转载 对Linux系统休眠的理解
转载:http://blog.chinaunix.net/uid-20543672-id-3248664.html 作者:Tekkaman Ninja
2015-06-18 11:28:07 504
原创 Linux内核中kfifo使用
/* * Sample kfifo byte stream implementation * * Copyright (C) 2010 Stefani Seibold <[email protected]> * * Released under the GPL version 2 only. * */#include <linux/init.h>#include <linux/m
2015-06-17 18:02:59 2513
转载 apt-get使用总结
专载:http://blog.chinaunix.net/uid-9525959-id-2001625.html[功能] ubuntu下面的软件包管理工具。[举例]目前常用的*更新本机中的数据库缓存: sudo apt-get update*查找包含部分关键字的软件包: sudo apt-cache search <你要查找的name>*安装指定的软件: sudo apt-get insta
2015-06-11 18:36:33 419
原创 获取路由器网络信息(mac,ip,router,dns,dhcp clients)
1.获取接口的mac地址char *get_macaddr(char *ifname){ struct ifreq ifr; char *ptr; int skfd; static char if_hw[18] = {0}; if((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { fprintf(s
2015-06-11 17:38:07 2465
原创 Ubuntu 14.04 Linux内核版本3.16.0内核模块开发Makefile文件样板
#!/bin/shifneq ($(KERNELRELEASE), ) obj-m := rbtree_test.o //改成自己的模块名称elsePWD :=$(shell pwd)KVER ?=$(shell uname -r)KDIR :=/lib/modules/$(KVER)/buildall: $(MAKE) -C $(KDIR) M=$(PWD)clean:
2015-06-10 18:01:13 689
原创 Linux 内核基础--rb_tree使用方法
1.在你的所要使用的模块中包含头文件#include<linux/rb_tree.h>2.将rb_node嵌入到自己结构体中struct my_data{ struct rb_node node; char key[32]; char value[32]};3.定义rb树的根,一般为全局变量struct rb_root my_root_tree = RB_ROOT;4.实现
2015-06-10 17:32:55 2667 2
原创 Linux 内核基础--List使用方法
1.引入头文件#include <linux/list.h>2.嵌入其他结构体中作为一个结构体成员struct fox{ int id; struct list_head list;};3.声明并初始化头结点struct list_head ptr_head;INIT_LIST_HEAD(&ptr_head);4.操作list添加操作: list_add(&fox_new.li
2015-06-10 02:05:49 797 1
原创 Linux内核实现List二个关键的宏offsetof 和 container_of
二个宏定义在inux/kernel.h头文件1.offsetof offsetof宏的定义如下: #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 关键之处在于将地址0强制转换为type类型的指针,从而定位到member在结构体中偏移位置。编译器认为0是一个有效的地址,从而认为0是type指针的起始地址。2.c
2015-06-09 15:27:35 622
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人