02 2011 档案

摘要:大多数脚本语言都有here document, 因为它太有用了。 为什么有用? 你受得了 C “”字符串里不断的 \” \t \r 等解引用吗,还有 多行字符串的拼接 “a”"b”。所以我讨厌 C的字符串处理,更讨厌用C来写 cgi。 here document 让一切都清静了。 作为历史悠久的bash也不例外。 cat << EOF ok , baby EOF 我经常使用 here docu... 阅读全文
posted @ 2011-02-25 14:54 napoleon_liu 阅读(2489) 评论(1) 推荐(0)
摘要:使用TCP_DEFER_ACCEPT可以减少用户程序hold的连接数,也可以减少用户调用epoll_ctl和epoll_wait的次数,从而提高了程序的性能。 设置listen套接字的TCP_DEFER_ACCEPT选项后, 只当一个链接有数据时是才会从accpet中返回(而不是三次握手完成)。 使用方法: #include <netinet/tcp.h> int timeout=1; sets... 阅读全文
posted @ 2011-02-24 19:56 napoleon_liu 阅读(3065) 评论(0) 推荐(0)
摘要:来自Linus Torvalds的讨论: [url]https://groups.google.com/group/linux.kernel/browse_thread/thread/b70bffe9015a8c41/ed9c0a0cfcd31111[/url] 又,[url]http://kerneltrap.org/Linux/Further_Oops_Insights[/url] ) ... 阅读全文
posted @ 2011-02-18 10:11 napoleon_liu 阅读(1106) 评论(0) 推荐(0)
摘要:我们知道ldd开查看程序依赖的 动态库 已经 为解决的符号。但运行时加载过程去没有办法知道。这就需要用到LD_DEBUG   LD_DEBUG 是 glibc 的 loader 为了调试而设置的一个环境变量。 通过设置这个环境变量,可以调试动态库的 加载过程。 设置 LD_DEBUG 环境变量获得更多信息: $ LD_DEBUG=help ls Valid options f... 阅读全文
posted @ 2011-02-16 20:02 napoleon_liu 阅读(512) 评论(0) 推荐(0)
摘要:This tutorial will show you how to manually rebuild a backtrace with GDB on x86 using the stack frame pointer and current instruction pointer. Consider the following gdb backtrace: It's pretty clear t... 阅读全文
posted @ 2011-02-14 14:04 napoleon_liu 阅读(1615) 评论(0) 推荐(0)
摘要:以堆栈溢出为代表的缓冲区溢出已成为最为普遍的安全漏洞。由此引发的安全问题比比皆是。早在 1988 年,美国康奈尔大学的计算机科学系研究生莫里斯 (Morris) 利用 UNIX fingered 程序的溢出漏洞,写了一段恶意程序并传播到其他机器上,结果造成 6000 台 Internet 上的服务器瘫痪,占当时总数的 10%。各种操作系统上出现的溢出漏洞也数不胜数。为了尽可能避免缓冲区溢出漏洞被攻... 阅读全文
posted @ 2011-02-14 00:59 napoleon_liu 阅读(12719) 评论(1) 推荐(3)