Mailing List Archive

help for tftp-hpa with libc5
I want to compile tftp-hpa on libc5 because we have many systems still using
this library.

There were some constants missing that i copied from glibc-2.1 headers, and
now I'm left with this and I don't know what to do since all I can do is
copy/paste, not touch real code :-)

===
gcc -O2 -m486 -fno-strength-reduce -D_XPG4_2 -D_XOPEN_SOURCE
-D__EXTENSIONS__ -D_BSD_SOURCE -D_ISO9X_SOURCE -D_OSF_SOURCE
-D_XOPEN_SOURCE_EXTENDED -W -Wall -Wpointer-arith -Wbad-function-cast
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
-Wnested-externs -Winline -Wwrite-strings -Wshadow -pipe -I.. -c recvfrom.c
In file included from ../config.h:37,
from recvfrom.c:21:
/usr/include/stdlib.h:149: warning: no previous prototype for `strtold'
recvfrom.c: In function `myrecvfrom':
recvfrom.c:64: field `cm' has incomplete type <========
recvfrom.c:69: sizeof applied to an incomplete type <=========
recvfrom.c:105: sizeof applied to an incomplete type
recvfrom.c:105: warning: unsigned value < 0 is always 0
recvfrom.c:109: sizeof applied to an incomplete type
recvfrom.c:109: warning: unsigned value >= 0 is always 1
recvfrom.c:72: warning: unused variable `on'
make: *** [recvfrom.o] Error 1
===

=== recvfrom.c line 62 onwards
struct cmsghdr *cmptr;
union {
struct cmsghdr cm;
#ifdef IP_PKTINFO
char control[CMSG_SPACE(sizeof(struct in_addr)) +
CMSG_SPACE(sizeof(struct in_pktinfo))];
#else
char control[CMSG_SPACE(sizeof(struct in_addr))];
#endif
} control_un;
int on = 1;
#ifdef IP_PKTINFO
struct in_pktinfo pktinfo;
#endif

=== 105
if ( msg.msg_controllen < sizeof(struct cmsghdr) ||

=== 109
for ( cmptr = CMSG_FIRSTHDR(&msg) ; cmptr != NULL ;

I added the following to recvfrom.h (copied from glibc headers)
===
#define MSG_CTRUNC 0x08
#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
#define CMSG_FIRSTHDR(mhdr) \
((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)

extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr,
struct cmsghdr *__cmsg));
#ifdef __USE_EXTERN_INLINES
# ifndef _EXTERN_INLINE
# define _EXTERN_INLINE extern __inline
# endif
_EXTERN_INLINE struct cmsghdr *
__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
{
if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
/* The kernel header does this so there may be a reason. */
return 0;
__cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+ CMSG_ALIGN (__cmsg->cmsg_len));
if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *)
__mhdr->msg_control
+ __mhdr->msg_controllen)
|| ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
>= ((unsigned char *) __mhdr->msg_control +
__mhdr->msg_controllen)))
/* No more entries. */
return 0;
return __cmsg;
}
#endif /* Use `extern inline'. */

===

Thanks

--
giulioo@pobox.com
help for tftp-hpa with libc5 [ In reply to ]
Giulio Orsero wrote:

> I want to compile tftp-hpa on libc5 because we have many systems still using
> this library.
>
> There were some constants missing that i copied from glibc-2.1 headers, and
> now I'm left with this and I don't know what to do since all I can do is
> copy/paste, not touch real code :-)
>


You probably don't want to use that... instead, you want to disable the
"advanced" version of that particular code... you need a lot of header
file support for it.

-hpa
help for tftp-hpa with libc5 [ In reply to ]
On Mon, 21 Jan 2002 10:57:17 -0800, "H. Peter Anvin" <hpa@zytor.com> wrote:

>Giulio Orsero wrote:
>> I want to compile tftp-hpa on libc5 because we have many systems still using
>> this library.
>You probably don't want to use that... instead, you want to disable the
>"advanced" version of that particular code... you need a lot of header
>file support for it.

Ok, done that and works correctly, thanks.

--
giulioo@pobox.com