Ultrix patches version 2 for bind 8.2.2-P3

Paul A Vixie vixie at mibh.net
Wed Nov 17 01:55:03 UTC 1999


> Here's a second version of my patches for ultrix support.  This
> introduces a new funtion called _bind_sprintf() to noop.c that
> returns the length of the string printed to regardless of whether
> the library is linked with -YPOSIX or not.

1. noop.c is there so that "ar" will not complain about having no files to
add, and "ld" won't complain that there are no files in the library.  it's
a shill, a nothing, a discard.  as soon as a port has even one actual file
that has actual code in it, then noop.c can be removed (by me, usually,
since there are CVS things to do at that same time.)

2. _bind_sprintf() is probably the wrong name for it, and the port/ultrix/
directory is probably the wrong place for it.  this is portable code, and
it can be in lib/isc/sprintf.c, and can be extern'd and #define'd in some
new file like include/isc/sprintf.h.  then any .c file who depends on sprintf
returning int should call this instead of the native (nonportable) sprintf.

> diff -ur ../src-DIST/INSTALL ./INSTALL
> --- ../src-DIST/INSTALL	Tue Nov  9 09:59:15 1999
> +++ ./INSTALL	Wed Nov 10 00:03:16 1999
> @@ -186,6 +186,12 @@
>  		the problem.  Either run make with "SH=bash" on the command
>  		line, or edit src/Makefile and change "SH=sh" to "SH=bash".
>  
> +	Ultrix
> +
> +		The ultrix /bin/sh is brain-dead.  Either run make with
> +		"SH=sh5" on the command linke, or edit src/Makefile and
> +		change "SH=sh" to "SH=sh5".
> +
>  FD_SETSIZE
>  
>  	The highest numbered file descriptor that the server and the resolver

3. did you try setting SH=/bin/sh5 in port/ultrix/Makefile.set?  that may
be enough, depending on whether the sh-vs-sh5 problems are being encountered
in the top level Makefile or in the ones lower down.

> diff -ur ../src-DIST/bin/named/ns_glue.c ./bin/named/ns_glue.c
> --- ../src-DIST/bin/named/ns_glue.c	Tue Oct 19 12:06:26 1999
> +++ ./bin/named/ns_glue.c	Wed Nov 10 15:54:36 1999
> @@ -448,3 +448,14 @@
>  	return (rename(oldname, newname));
>  }
>  #endif
> +
> +#ifdef ICKY_YUCKY_ULTRIX_STUFF
> +#undef res_send
> +int res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) {
> +	return __res_send(buf, buflen, ans, anssiz);
> +}
> +#undef _res_close
> +void _res_close(void) {
> +	__res_close();
> +}
> +#endif

4. is there some reason why "#ifdef ultrix" isn't enough here?

> diff -ur ../src-DIST/bin/named-xfer/named-xfer.c ./bin/named-xfer/named-xfer.c
> --- ../src-DIST/bin/named-xfer/named-xfer.c	Tue Nov  9 10:01:39 1999
> +++ ./bin/named-xfer/named-xfer.c	Tue Nov  9 23:45:49 1999
> @@ -1151,7 +1151,7 @@
>  		 */
>  		if (hp->rcode != NOERROR || !hp->aa || qdcount != 1 ||
>  		    (ancount < 1 && aucount < 1)) {
> -#ifndef ultrix  /*XXX*/
> +#ifndef SYSLOG_42BSD
>  			syslog(LOG_NOTICE,
>         "[%s] %s for %s, SOA query got rcode %d, aa %d, ancount %d, aucount %d",
>  			       inet_ntoa(sin.sin_addr),
> diff -ur ../src-DIST/lib/bsd/Makefile ./lib/bsd/Makefile
> --- ../src-DIST/lib/bsd/Makefile	Mon Feb 22 13:47:57 1999
> +++ ./lib/bsd/Makefile	Wed Nov 10 23:50:43 1999
> @@ -61,7 +61,7 @@
>  	${RANLIB} ${LIBBIND}
>  
>  .c.${O}:
> -	if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
> +	-if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
>  	${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} -c $*.c \
>  	 -o ${THREADED}/$*.${O}
>  	-${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} -o a.out && \
> diff -ur ../src-DIST/lib/cylink/Makefile ./lib/cylink/Makefile
> --- ../src-DIST/lib/cylink/Makefile	Mon Feb 22 13:47:57 1999
> +++ ./lib/cylink/Makefile	Wed Nov 10 23:50:48 1999
> @@ -60,7 +60,7 @@
>  	${RANLIB} ${LIBBIND}
>  
>  .c.${O}:
> -	if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
> +	-if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
>  	${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} -c $*.c \
>  	 -o ${THREADED}/$*.${O}
>  	-${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} -o a.out && \
> diff -ur ../src-DIST/lib/dnssafe/Makefile ./lib/dnssafe/Makefile
> --- ../src-DIST/lib/dnssafe/Makefile	Tue Feb 23 16:26:59 1999
> +++ ./lib/dnssafe/Makefile	Wed Nov 10 23:50:51 1999
> @@ -81,7 +81,7 @@
>  
>  
>  .c.${O}:
> -	if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
> +	-if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
>  	${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} -c $*.c \
>  	 -o ${THREADED}/$*.${O}
>  	-${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} && \
> diff -ur ../src-DIST/lib/dst/Makefile ./lib/dst/Makefile
> --- ../src-DIST/lib/dst/Makefile	Sun Mar  7 20:33:47 1999
> +++ ./lib/dst/Makefile	Wed Nov 10 23:50:54 1999
> @@ -63,7 +63,7 @@
>  	${RANLIB} ${LIBBIND}
>  
>  .c.${O}:
> -	if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
> +	-if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
>  	${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} ${CRYPTINCL} ${CRYPTFLAGS} -c $*.c -o ${THREADED}/$*.${O}
>  	-${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} -o a.out && \
>  	 ${LDS} mv a.out ${THREADED}/$*.${O}
> diff -ur ../src-DIST/lib/inet/Makefile ./lib/inet/Makefile
> --- ../src-DIST/lib/inet/Makefile	Wed Mar  3 19:07:16 1999
> +++ ./lib/inet/Makefile	Wed Nov 10 23:50:56 1999
> @@ -61,7 +61,7 @@
>  	${RANLIB} ${LIBBIND}
>  
>  .c.${O}:
> -	if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
> +	-if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
>  	${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} -c $*.c \
>  	 -o ${THREADED}/$*.${O}
>  	-${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} -o a.out && \
> diff -ur ../src-DIST/lib/irs/Makefile ./lib/irs/Makefile
> --- ../src-DIST/lib/irs/Makefile	Mon Feb 22 13:47:58 1999
> +++ ./lib/irs/Makefile	Wed Nov 10 23:50:59 1999
> @@ -82,7 +82,7 @@
>  	${RANLIB} ${LIBBIND}
>  
>  .c.${O}:
> -	if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
> +	-if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
>  	-(${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} -c $*.c \
>  	 -o ${THREADED}/$*.${O} ; \
>  	 ${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} && \
> diff -ur ../src-DIST/lib/isc/Makefile ./lib/isc/Makefile
> --- ../src-DIST/lib/isc/Makefile	Mon Feb 22 13:47:58 1999
> +++ ./lib/isc/Makefile	Wed Nov 10 23:51:03 1999
> @@ -64,7 +64,7 @@
>  	${RANLIB} ${LIBBIND}
>  
>  .c.${O}:
> -	if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
> +	-if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
>  	${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} -c $*.c \
>  	 -o ${THREADED}/$*.${O}
>  	-${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} -o a.out && \
> diff -ur ../src-DIST/lib/nameser/Makefile ./lib/nameser/Makefile
> --- ../src-DIST/lib/nameser/Makefile	Tue Sep  7 18:47:28 1999
> +++ ./lib/nameser/Makefile	Wed Nov 10 23:51:09 1999
> @@ -59,7 +59,7 @@
>  	${RANLIB} ${LIBBIND}
>  
>  .c.${O}:
> -	if test ! -d ${THREADED} ;  then mkdir ${THREADED} ; fi
> +	-if test ! -d ${THREADED} ;  then mkdir ${THREADED} ; fi
>  	${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} -c $*.c \
>  	 -o ${THREADED}/$*.${O}
>  	-${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} -o a.out && \
> diff -ur ../src-DIST/lib/resolv/Makefile ./lib/resolv/Makefile
> --- ../src-DIST/lib/resolv/Makefile	Thu Oct  7 18:24:15 1999
> +++ ./lib/resolv/Makefile	Wed Nov 10 23:51:13 1999
> @@ -62,7 +62,7 @@
>  	${RANLIB} ${LIBBIND}
>  
>  .c.${O}:
> -	if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
> +	-if test ! -d ${THREADED} ; then mkdir ${THREADED} ; fi
>  	${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} -c $*.c \
>  	 -o ${THREADED}/$*.${O}
>  	-${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} -o a.out && \
> diff -ur ../src-DIST/port/ultrix/Makefile.set ./port/ultrix/Makefile.set

that's all fine.

> --- ../src-DIST/port/ultrix/Makefile.set	Fri Mar 20 06:50:35 1998
> +++ ./port/ultrix/Makefile.set	Wed Nov 10 11:22:56 1999
> @@ -1,4 +1,4 @@
> -'CC=cc -YPOSIX -Dconst='
> +'CC=cc -std1'
>  'CDEBUG=-g2 -O1 -Olimit 2000'
>  'DESTBIN=/usr/bin'
>  'DESTSBIN=/usr/etc'

5. so now, if a program wants to link against libbind.a, it must NOT use
-YPOSIX when it is compiled?  that hardly seems right.  please leave this
as it was unless something is broken by -YPOSIX that isn't fixed by
isc_sprintf().

> diff -ur ../src-DIST/port/ultrix/include/port_after.h ./port/ultrix/include/port_after.h
> --- ../src-DIST/port/ultrix/include/port_after.h	Sun Sep  5 16:23:21 1999
> +++ ./port/ultrix/include/port_after.h	Sat Nov 13 00:37:54 1999
> @@ -29,6 +29,7 @@
>  #define SIOCGIFCONF_ADDR
>  #define HAVE_CHROOT
>  #define CAN_CHANGE_ID
> +#define ICKY_YUCKY_ULTRIX_STUFF	/* XXX Ugly glue for named and Ultrix' libc resolver */
>  
>  #define _TIMEZONE	timezone
>  #define SIG_FN		void
> @@ -71,6 +72,13 @@
>  	u_int32_t	sin6_scope_id;	/* set of interfaces for a scope */
>  };
>  #endif	/* HAS_INET6_STRUCTS */
> +
> +/* ULTRIX has two different sprintf's depending on the compile options!
> + * We'll provide one that returns what we want it to.
> + */
> +#define sprintf _bind_sprintf
> +int _bind_sprintf(char *__s, const char *__format, ... );
> +
>  #define NEED_STRSEP
>  extern char *strsep(char **, const char *);

6. see above (#2, #4).

> diff -ur ../src-DIST/port/ultrix/include/port_before.h ./port/ultrix/include/port_before.h
> --- ../src-DIST/port/ultrix/include/port_before.h	Sun Sep  5 16:23:22 1999
> +++ ./port/ultrix/include/port_before.h	Wed Nov 10 22:47:15 1999
> @@ -14,6 +14,7 @@
>  #define WANT_IRS_NIS
>  #undef WANT_IRS_PW
>  #undef WANT_IRS_GR
> +#define SIG_FN void
>  
>  #include <time.h>
>  struct timespec {
> @@ -24,5 +25,8 @@
>  #if defined(HAS_PTHREADS) && defined(_REENTRANT)
>  #define DO_PTHREADS
>  #endif
> +
> +#define LITTLE_ENDIAN	1234
> +#define BYTE_ORDER	LITTLE_ENDIAN
>  
>  #endif /*PORT_BEFORE_H*/
>
> diff -ur ../src-DIST/port/ultrix/include/prand_conf.h ./port/ultrix/include/prand_conf.h
> --- ../src-DIST/port/ultrix/include/prand_conf.h	Sun Sep  5 17:04:07 1999
> +++ ./port/ultrix/include/prand_conf.h	Tue Nov  9 23:49:07 1999
> @@ -2,13 +2,15 @@
>  #define _PRAND_CMD_H_
>  
>  const char *cmds[] = {
> -	"/bin/ps -aux 2>&1",
> +	"/bin/ps -alwx 2>&1",
>  	"/usr/etc/arp -an 2>&1",
>  	"/usr/ucb/netstat -an 2>&1",
>  	"/usr/bin/df  2>&1",
>  	"/usr/ucb/uptime  2>&1",
> -	"/usr/ucb/netstat -an 2>&1",
> +	"/usr/ucb/netstat -s 2>&1",
>  	"/usr/bin/iostat  2>&1",
> +	"/usr/ucb/vmstat  2>&1",
> +	"/usr/ucb/w  2>&1",
>  	NULL
>  };

this is good stuff.

> diff -ur ../src-DIST/port/ultrix/noop.c ./port/ultrix/noop.c
> --- ../src-DIST/port/ultrix/noop.c	Thu Nov 21 21:28:34 1996
> +++ ./port/ultrix/noop.c	Sat Nov 13 00:52:50 1999
> @@ -1,4 +1,30 @@
> +#include <stdio.h>
> +#include <varargs.h>
> +
>  void
>  __bind_noop() {
>  	/* NOOP */
> +}
> +
> +/* An implementation of sprintf() that always returns an int
> + * regardless of the compile environment.  This is also pretty
> + * easy to adapt to snprintf().
> + */
> +int _bind_sprintf(str, fmt, va_alist)
> +	char *str;
> +	const char *fmt;
> +	va_dcl
> +{
> +	int len;
> +	FILE f;
> +	va_list(ap);
> +
> +	f._flag = _IOSTRG | _IOWRT;
> +	f._base = f._ptr = str;
> +	f._cnt = 32767;
> +	va_start(ap);
> +	len = _doprnt(fmt, ap, &f);
> +	va_end(ap);
> +	f._ptr = '\0';
> +	return(len);
>  }

see #1.



More information about the bind-workers mailing list