struct protoent结构,getprotobyname 及相关函数
在我的嵌入式设备中写了一个抓包程序,获取协议号的信息,结果在调用getprotobynumber时老是出错返回的protoent结构指针始终为空,打印了调试信息
/* Open protocol data base files and mark them as staying open even after a later search if STAY_OPEN is non-zero. This function is a possible cancellation point and therefore not marked with __THROW. */extern void setprotoent (int __stay_open);/* Close protocol data base files and clear `stay open' flag. This function is a possible cancellation point and therefore not marked with __THROW. */extern void endprotoent (void);/* Get next entry from protocol data base file. Open data base if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */extern struct protoent *getprotoent (void);/* Return entry from protocol data base for network with NAME. This function is a possible cancellation point and therefore not marked with __THROW. */extern struct protoent *getprotobyname (__const char *__name);/* Return entry from protocol data base which number is PROTO. This function is a possible cancellation point and therefore not marked with __THROW. */extern struct protoent *getprotobynumber (int __proto);
=================end========================