(转)UNIX网络编程 卷2 源代码使用

http://blog.sina.com.cn/s/blog_70b6ff9601013vjn.html

1. 下载源码,W. Richard Stevens的主页:http://www.kohala.com/start/
wget http://www.kohala.com/start/unpv22e/unpv22e.tar.gz -P /usr/local/src
2. 解压
tar xvf /usr/local/src/unpv22e.tar.gz -C /root/bin
3. 编译库文件
cd /root/bin/unpv22e/
./configure
编辑生成config.h文件,注释以下几行
vi config.h 
56 // #define uint8_t unsigned char 
57 // #define uint16_t unsigned short 
58 // #define uint32_t unsigned int 
添加MSG_R和MSG_W定义
vi config.h 
66 // add by jcq 
67 typedef unsigned long ulong_t; 
68 #define MSG_R 0400 
69 #define MSG_W 0200
添加_GNU_SOURCE定义
vi config.h 
#define _GNU_SOURCE
编译warpunix.c,使用mkstemp函数替换mktemp函数
cd lib 
181 void 
182 Mktemp(char *template) 
183 { 
184 if (mkstemp(template) == NULL || template[0] == 0) 
185 err_quit("mktemp error"); 
186 }
编译生成libunpipc.a
cd lib 
make
posted @ 2013-03-10 18:00  酷林  阅读(217)  评论(0)    收藏  举报