Paul_GreenVOS@vos.stratus.com
2002-Oct-14 16:14 UTC
[PATCH] Patches to rsync-2.5.5 for Stratus VOS (resend)
** This is a resend of mail I originally sent on September 5th. I am still interested in getting these patches applied, and getting a new config.guess and config.sub. Is there anything else I need to do in order to get these changes accepted? Thanks. PG ** I had to make some patches to rsync to get it to build on VOS. We are a POSIX-96 (but not Unix) system. Here is the subset of the patches that I think are general to all platforms. I have tested these here. I was surprised that CPPFLAGS is not available to the compilation rules in the Makefile. Most other packages (e.g. Samba) seem to allow CPPFLAGS to be set by the user. Since this is how I pass -D_POSIX_C_SOURCE=199506L -D_SYSV to GCC, I added it. I am not enclosing patches for config.guess and config.sub, but I would request that you pick up current copies of these. The ones in the rsync-2.5.5 package are a year old and do not recognize VOS (the current ones do recognize us). These patches change some Unix types to POSIX types (u_char -> uchar_t), hide various unused declarations on systems that don't implement IPv6, supply a network constants if the system doesn't supply it, and properly supply a version of inet_pton on systems that don't have one. (Looks like an editing error misspelled inet_pton). If you have any questions, please let me know. My normal e-mail address is Paul.Green@stratus.com; I use this other one to send patches because I know it won't wrap the lines. ### START OF PATCHES ### diff -urp --new-file oldrsync/Makefile.in newrsync/Makefile.in --- oldrsync/Makefile.in Tue Aug 27 11:04:16 2002 +++ newrsync/Makefile.in Thu Sep 5 18:09:53 2002 @@ -9,6 +9,7 @@ mandir=@mandir@ LIBS=@LIBS@ CC=@CC@ CFLAGS=@CFLAGS@ +CPPFLAGS=@CPPFLAGS@ LDFLAGS=@LDFLAGS@ INSTALLCMD=@INSTALL@ @@ -45,7 +46,7 @@ CHECK_PROGS = rsync tls getgroups trimsl # note that the -I. is needed to handle config.h when using VPATH .c.o: @OBJ_SAVE@ - $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< @CC_SHOBJ_FLAG@ + $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@ @OBJ_RESTORE@ all: rsync @@ -65,19 +66,19 @@ install-strip: rsync: $(OBJS) @echo "Please ignore warnings below about mktemp -- it is used in a safe way" - $(CC) $(CFLAGS) $(LDFLAGS) -o rsync $(OBJS) $(LIBS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rsync $(OBJS) $(LIBS) $(OBJS): config.h tls: $(TLS_OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS) getgroups: getgroups.o - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS) TRIMSLASH_OBJ = trimslash.o syscall.o trimslash: $(TRIMSLASH_OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS) Makefile: Makefile.in configure config.status echo "WARNING: You need to run ./config.status --recheck" diff -urp --new-file oldrsync/lib/getaddrinfo.c newrsync/lib/getaddrinfo.c --- oldrsync/lib/getaddrinfo.c Tue Aug 27 11:05:47 2002 +++ newrsync/lib/getaddrinfo.c Tue Aug 27 15:46:48 2002 @@ -73,9 +73,9 @@ static const char in6_loopback[] = { }; struct sockinet { - u_char si_len; - u_char si_family; - u_short si_port; + uchar_t si_len; + uchar_t si_family; + ushort_t si_port; }; static struct afd { @@ -223,7 +223,7 @@ getaddrinfo(hostname, servname, hints, r char pton[PTON_MAX]; struct addrinfo ai; struct addrinfo *pai; - u_short port; + ushort_t port; #ifdef FAITH static int firsttime = 1; @@ -395,8 +395,10 @@ getaddrinfo(hostname, servname, hints, r /* hostname as numeric name */ for (i = 0; afdl[i].a_af; i++) { if (inet_pton(afdl[i].a_af, hostname, pton)) { - u_long v4a; - u_char pfx; + ulong_t v4a; +#ifdef INET6 + uchar_t pfx; +#endif switch (afdl[i].a_af) { case AF_INET: @@ -470,10 +472,13 @@ get_name(addr, afd, res, numaddr, pai, p struct addrinfo *pai; int port0; { - u_short port = port0 & 0xffff; + ushort_t port = port0 & 0xffff; struct hostent *hp; struct addrinfo *cur; - int error = 0, h_error; + int error = 0; +#ifdef INET6 + int h_error; +#endif #ifdef INET6 hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error); @@ -515,7 +520,7 @@ get_addr(hostname, af, res, pai, port0) struct addrinfo *pai; int port0; { - u_short port = port0 & 0xffff; + ushort_t port = port0 & 0xffff; struct addrinfo sentinel; struct hostent *hp; struct addrinfo *top, *cur; diff -urp --new-file oldrsync/lib/getnameinfo.c newrsync/lib/getnameinfo.c --- oldrsync/lib/getnameinfo.c Tue Aug 27 11:05:47 2002 +++ newrsync/lib/getnameinfo.c Tue Aug 27 15:44:58 2002 @@ -54,13 +54,13 @@ static struct afd { #endif {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in), offsetof(struct sockaddr_in, sin_addr)}, - {0, 0, 0}, + {0, 0, 0, 0}, }; struct sockinet { - u_char si_len; - u_char si_family; - u_short si_port; + uchar_t si_len; + uchar_t si_family; + ushort_t si_port; }; #define ENI_NOSOCKET 0 @@ -85,11 +85,11 @@ getnameinfo(sa, salen, host, hostlen, se struct afd *afd; struct servent *sp; struct hostent *hp; - u_short port; + ushort_t port; int family, i; char *addr, *p; - u_long v4a; - u_char pfx; + ulong_t v4a; + uchar_t pfx; int h_error; char numserv[512]; char numaddr[512]; diff -urp --new-file oldrsync/lib/inet_pton.c newrsync/lib/inet_pton.c --- oldrsync/lib/inet_pton.c Tue Aug 27 15:45:14 2002 +++ newrsync/lib/inet_pton.c Tue Aug 27 15:45:21 2002 @@ -27,10 +27,12 @@ */ static int inet_pton4(const char *src, unsigned char *dst); +#ifdef INET6 static int inet_pton6(const char *src, unsigned char *dst); +#endif /* int - * isc_net_pton(af, src, dst) + * inet_pton(af, src, dst) * convert from presentation format (which usually means ASCII printable) * to network format (which is usually some kind of binary format). * return: diff -urp --new-file oldrsync/lib/permstring.c newrsync/lib/permstring.c --- oldrsync/lib/permstring.c Tue Aug 27 11:05:47 2002 +++ newrsync/lib/permstring.c Tue Aug 27 15:45:34 2002 @@ -47,8 +47,10 @@ void permstring(char *perms, if (mode & S_ISGID) perms[6] = (mode & S_IXGRP) ? 's' : 'S'; +#ifdef S_ISVTX if (mode & S_ISVTX) perms[9] = (mode & S_IXOTH) ? 't' : 'T'; +#endif if (S_ISLNK(mode)) perms[0] = 'l'; if (S_ISDIR(mode)) perms[0] = 'd'; diff -urp --new-file oldrsync/rsync.h newrsync/rsync.h --- oldrsync/rsync.h Tue Aug 27 12:03:52 2002 +++ newrsync/rsync.h Tue Aug 27 15:44:38 2002 @@ -330,6 +330,10 @@ enum logcode {FNONE=0, FERROR=1, FINFO=2 #define INADDR_NONE 0xffffffff #endif +#ifndef IN_LOOPBACKNET +#define IN_LOOPBACKNET 127 +#endif + struct file_struct { unsigned flags; time_t modtime; @@ -614,7 +618,7 @@ inet_ntop(int af, const void *src, char #endif /* !HAVE_INET_NTOP */ #ifndef HAVE_INET_PTON -int isc_net_pton(int af, const char *src, void *dst); +int inet_pton(int af, const char *src, void *dst); #endif #define UNUSED(x) x __attribute__((__unused__)) ### END OF PATCHES ### Thanks PG -- Paul Green | Mail: Paul.Green@stratus.com Senior Technical Consultant | Voice: +1 978-461-7557 FAX: +1 978-461-3610 Stratus Technologies | Video: PictureTel/AT&T by request. Maynard, MA 01754 | Disclaimer: I speak for myself, not Stratus.