您的位置:首页 > 运维架构 > Linux

今天有点热,继续看源码

2011-05-10 18:41 232 查看
1、wc原来也是一个命令啊,前几天就见到了。

         我猜 word count 的缩写吧

2、通过结构成员的地址,得到结构本身的地址
/**
 * list_entry - get the struct for this entry
 * @ptr: the &struct list_head pointer.
 * @type: the type of the struct this is embedded in.
 * @member: the name of the list_struct within the struct.
 */
#define list_entry(ptr, type, member) /
 container_of(ptr, type, member)
 
3、查看linux版本
   (1)uname 命令:查看系统信息
   (2)cat  /proc/version     uname是不是直接用的这个啊

4、typeof关键字

    是不是和sizeof是兄弟啊,其实差不多的,sizeof()是去得到大小,而typeof()是得到类型

    typeof是gcc对C语言的一个扩展保留字,用于声明变量类型,比方说:

  typeof(int   *)   p;
  声明p为一个int类型的指针
  typeof(*x)   p;
  声明p为x所指向的类型

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐