源码阅读笔记:webbench-1.5
WebBench是个比较简单的程序,只有两个源文件:webbench.c, socket.c。 对源码重新排版一下,方便阅读: /* * (C) Radim Kolar 1997-2004 * This is free software, see GNU Public License version 2 for * details. * * Simple forking WWW Server benchmark: * * Usage: * webbench --help * * Return codes: * 0 - sucess * 1 - benchmark failed (server is not on-line) * 2 - bad param * 3 - internal error, fork failed * */ #include "socket.c" #include <unistd.h> #include <sys/param.h> #include <rpc/types.h> #include <getopt.h> #include <strings.h> #include <time.h> #include <signal.h> /* * 超时标记,当被设置为 1 时,所有子进程退出 * volatile: * - 让系统总是从内存读取数据, * -