摘要: #ifndef _LINUX_LIST_H#define _LINUX_LIST_H/** Simple doubly linked list implementation.** Some of the internal functions ("__xxx") are useful when* manipulating whole lists rather than single entries, as* sometimes we already know the next/prev entries and we can* generate better code by u 阅读全文
posted @ 2013-10-23 15:38 摩斯电码 阅读(452) 评论(0) 推荐(0) 编辑
摘要: 如何根据一个结构体成员的地址、结构体类型以及该结构体成员名获得该结构体的首地址?#define list_entry(ptr, type, member) \ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))其中,ptr为指向该结构体成员的指针,type为该结构的类型,member为该结构成员的名称。理解: &((type *)0)->member的目的是为了获得上图中问号表示的范围的大小。这段代码等价于:type * p = (type *)0; //便于获得某个结构体成员相对于该结构体 阅读全文
posted @ 2013-10-23 15:19 摩斯电码 阅读(928) 评论(0) 推荐(0) 编辑
摘要: 参考:http://www.cyberciti.biz/faq/linux-unix-bsd-xargs-construct-argument-lists-utility/http://linux.101hacks.com/linux-commands/xargs-command-examples/http://www.computerhope.com/unix/xargs.htmhttp://offbytwo.com/2011/06/26/things-you-didnt-know-about-xargs.htmlhttp://unixhelp.ed.ac.uk/CGI/man-cgi?xa 阅读全文
posted @ 2013-10-23 14:02 摩斯电码 阅读(1802) 评论(0) 推荐(0) 编辑