Unix Network Programming Episode 2

偶然发现其实还有第二卷的源码,就一起编译了。

注意unpipc.h只有在bench下面的是有具体内容的,编译时要将它的内容复制到其他的unpipc.h中。

今天编译所有的项目发现,只要是其他目录中有相同的文件名且内容一致,文件就是空白的,需要自己复制过去。

./configure    # try to figure out all implementation differences

cd lib
make

cd ../pipe
make pipeconf
./pipeconf /tmp

有一个错误,提示config.h中

In file included from unpipc.h:7:0,
                 from daemon_inetd.c:1:
../config.h:56:17: error: two or more data types in declaration specifiers
 #define uint8_t unsigned char    /*  */
                 ^
../config.h:56:26: error: two or more data types in declaration specifiers
 #define uint8_t unsigned char    /*  */
                          ^
../config.h:57:18: error: two or more data types in declaration specifiers
 #define uint16_t unsigned short    /*  */
                  ^
../config.h:57:27: error: two or more data types in declaration specifiers
 #define uint16_t unsigned short    /*  */
                           ^
../config.h:58:18: error: two or more data types in declaration specifiers
 #define uint32_t unsigned int    /*  */
                  ^
../config.h:58:27: error: two or more data types in declaration specifiers
 #define uint32_t unsigned int    /*  */
                           ^
make: *** [: daemon_inetd.o] Error 1

因此删除config.h中的

#define	uint8_t unsigned char				/*  */
#define	uint16_t unsigned short				/*  */
#define	uint32_t unsigned int				/*  */

即可。

unpipc.h中加上

#define SEM_R    0400   //用户(属主)读
#define SEM_A    0200   //用户(属主)写
#define	SVSEM_MODE	(SEM_R | SEM_A | SEM_R>>3 | SEM_R>>6)
#define MSG_R 0400
#define MSG_W 0200
struct msgbuf
{
    long int mtype; /* type of received/sent message */
    char mtext[1]; /* text of the message */
};

你可能感兴趣的:(Linux,Unix,Network,Programming)