Linux 判断机器的字节顺序
#include <fcntl.h>
int main(void)
{
typedef union un{
short s;
char c[sizeof(short)];
}un;
un myun;
myun.s = 0x0102;
if(sizeof(short) == 2){
if(myun.c[0] == 1 && myun.c[1] == 2)
printf("big-endian\r\n");
else if(myun.c[0] == 2 && myun.c[1] == 1)
printf("little-endian\r\n");
else
printf("unkown\r\n");
}
return 0;
}
摘自《Unix 网络编程》
相关文档:
地址:http://httpd.apache.org/
下载地址:http://httpd.apache.org/download.cgi
1,解压缩
tar -xzvf httpd-2.0.63.tar.gz
2,配置
./configure --prefix=/usr/local/apache --enable-module=all --enable-shared=max
3,编译
make
4,安装
make install
5,管理
apachectl start
apachectl stop
apachectl rest ......
cat 是一个文本文件查看和连接工具。查看一个文件的内容,用cat比较简单,就是cat 后面直接接文件名。
比如:
[root@localhost ~]# cat /etc/fstab
为了便于新手弟兄灵活掌握这个工具,我们多说一点常用的参数;
1.0 cat 语法结构;
cat [选项] [文件]...
选项
-A, --show-all &nbs ......
http://www.softhouse.com.cn/linux/knowledge/tech/7320.html
......
原来likely和unlikely是用来编译优化的,其实都可以没有。我们知道很多cpu里面有告诉缓存,且有预读机制,likely和unlikely就是增加执行判断语句时的命中率。
如果是if(lilely(a)),说明a条件发生的可能性大,那么a为真的语句在编译成二进制的时候就应该紧跟在前面程序的后面,这样就会被cache预读取进去,增加程序执行 ......