1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

* config.make.in (weak-symbols): Variable removed.

* configure.in (--with-weak-symbols): Option removed.
	(NO_UNDERSCORES, HAVE_ASM_WEAK_DIRECTIVE, HAVE_ASM_WEAKEXT_DIRECTIVE):
	New tests.
	* config.h.in (HAVE_WEAK_SYMBOLS): #undef removed.
	(NO_UNDERSCORES, HAVE_ASM_WEAK_DIRECTIVE, HAVE_ASM_WEAKEXT_DIRECTIVE):
	New #undefs.
	* libc-symbols.h: Use them instead of HAVE_WEAK_SYMBOLS.

	* inet/inet_lnaof.c: Use u_int32_t instead of u_long.
	* inet/inet_mkadr.c: Likewise.
	* inet/inet_net.c: Likewise.
	* inet/inet_netof.c: Likewise.
	* inet/rcmd.c: Likewise.
	* inet/arpa/inet.h: Likewise.
	* inet/netinet/in.h: Likewise.
	* inet/netinet/tcp.h: Likewise.
	* inet/protocols/rwhod.h: Likewise.
	* inet/protocols/talkd.h: Likewise.
	* resolv/inet_addr.c: Likewise.

	* sunrpc/rpc/xdr.h (IXDR_GET_LONG, IXDR_PUT_LONG): change casts to
 	u_int32_t (instead of u_long).
This commit is contained in:
Roland McGrath
1996-03-19 21:10:11 +00:00
parent b20e47cb14
commit c224a18a90
20 changed files with 385 additions and 206 deletions

View File

@ -1,9 +1,30 @@
Tue Mar 19 14:18:42 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> Tue Mar 19 14:18:42 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* config.make.in (weak-symbols): Variable removed.
* configure.in (--with-weak-symbols): Option removed.
(NO_UNDERSCORES, HAVE_ASM_WEAK_DIRECTIVE, HAVE_ASM_WEAKEXT_DIRECTIVE):
New tests.
* config.h.in (HAVE_WEAK_SYMBOLS): #undef removed.
(NO_UNDERSCORES, HAVE_ASM_WEAK_DIRECTIVE, HAVE_ASM_WEAKEXT_DIRECTIVE):
New #undefs.
* libc-symbols.h: Use them instead of HAVE_WEAK_SYMBOLS.
* sysdeps/unix/bsd/pause.c: Moved to sysdeps/unix/common/pause.c. * sysdeps/unix/bsd/pause.c: Moved to sysdeps/unix/common/pause.c.
Mon Mar 4 20:17:28 1996 David Mosberger-Tang <davidm@azstarnet.com> Mon Mar 4 20:17:28 1996 David Mosberger-Tang <davidm@azstarnet.com>
* inet/inet_lnaof.c: Use u_int32_t instead of u_long.
* inet/inet_mkadr.c: Likewise.
* inet/inet_net.c: Likewise.
* inet/inet_netof.c: Likewise.
* inet/rcmd.c: Likewise.
* inet/arpa/inet.h: Likewise.
* inet/netinet/in.h: Likewise.
* inet/netinet/tcp.h: Likewise.
* inet/protocols/rwhod.h: Likewise.
* inet/protocols/talkd.h: Likewise.
* resolv/inet_addr.c: Likewise.
* sysdeps/unix/sysv/linux/adjtime.c: Use INT_MAX instead of LONG_MAX. * sysdeps/unix/sysv/linux/adjtime.c: Use INT_MAX instead of LONG_MAX.
* sysdeps/unix/sysv/Makefile (sysdep_routines): Don't add s_getdents. * sysdeps/unix/sysv/Makefile (sysdep_routines): Don't add s_getdents.
@ -190,13 +211,13 @@ Wed Feb 14 00:21:17 1996 David Mosberger-Tang <davidm@azstarnet.com>
* sunrpc/svc.c (maskp): changed from u_long* to u_int32*. * sunrpc/svc.c (maskp): changed from u_long* to u_int32*.
* sunrpc/rpc/xdr.h (IXDR_GET_LONG, IXDR_PUT_LONG): change casts to
u_int32_t (instead of u_long).
* sunrpc/rpc_cmsg.c (xdr_callmsg), sunrpc/svc_authux.c: increment * sunrpc/rpc_cmsg.c (xdr_callmsg), sunrpc/svc_authux.c: increment
"buf" pointer by casting it to a char* first since a long* may be 8 "buf" pointer by casting it to a char* first since a long* may be 8
bytes or more and oa->oa_length may be any multiple of 4. bytes or more and oa->oa_length may be any multiple of 4.
* sunrpc/rpc/xdr.h (IXDR_GET_LONG, IXDR_PUT_LONG): change casts to
u_int32_t (instead of u_long).
* sunrpc/clnt_udp.c (clntudp_call): replaced sizeof(u_long) by 4 * sunrpc/clnt_udp.c (clntudp_call): replaced sizeof(u_long) by 4
since it really is testing for 32 bits. Fixed casts to use since it really is testing for 32 bits. Fixed casts to use
u_int32 instead of u_long. u_int32 instead of u_long.

View File

@ -4,12 +4,19 @@
#undef HAVE_GNU_LD #undef HAVE_GNU_LD
/* Define if using ELF, which supports weak symbols. /* Define if using ELF, which supports weak symbols.
This implies HAVE_WEAK_SYMBOLS; set by --with-elf. */ This implies HAVE_ASM_WEAK_DIRECTIVE and NO_UNDERSCORES; set by
--with-elf. */
#undef HAVE_ELF #undef HAVE_ELF
/* Define if weak symbols are available in the assembler and /* Define if C symbols are asm symbols. Don't define if C symbols
linker being used. Set by --with-weak-symbols. */ have a `_' prepended to make the asm symbol. */
#undef HAVE_WEAK_SYMBOLS #undef NO_UNDERSCORES
/* Define if weak symbols are available via the `.weak' directive. */
#undef HAVE_ASM_WEAK_DIRECTIVE
/* Define if weak symbols are available via the `.weakext' directive. */
#undef HAVE_ASM_WEAKEXT_DIRECTIVE
/* Define if not using ELF, but `.init' and `.fini' sections are available. */ /* Define if not using ELF, but `.init' and `.fini' sections are available. */
#undef HAVE_INITFINI #undef HAVE_INITFINI
@ -24,13 +31,6 @@
declaring a symbol global (default `.globl'). */ declaring a symbol global (default `.globl'). */
#undef ASM_GLOBAL_DIRECTIVE #undef ASM_GLOBAL_DIRECTIVE
/* ELF has weak symbols, and with GNU ld a.out does too. */
#ifndef HAVE_WEAK_SYMBOLS
#if defined (HAVE_ELF) || defined (HAVE_GNU_LD)
#define HAVE_WEAK_SYMBOLS
#endif
#endif
/* Define to use GNU libio instead of GNU stdio. /* Define to use GNU libio instead of GNU stdio.
This is defined by configure under --enable-libio. */ This is defined by configure under --enable-libio. */
#undef USE_IN_LIBIO #undef USE_IN_LIBIO

View File

@ -15,7 +15,6 @@ config-sysdirs = @sysnames@
config-defines = @DEFS@ config-defines = @DEFS@
elf = @elf@ elf = @elf@
weak-symbols = @weak@
have-initfini = @libc_cv_have_initfini@ have-initfini = @libc_cv_have_initfini@
# Configuration options. # Configuration options.

147
configure vendored
View File

@ -2,8 +2,8 @@
# From configure.in CVSid # From configure.in CVSid
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.7 # Generated automatically using autoconf version 2.9
# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
# #
# This configure script is free software; the Free Software Foundation # This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it. # gives unlimited permission to copy, distribute and modify it.
@ -26,8 +26,6 @@ ac_help="$ac_help
--with-gnu-as if using GNU as (in the binutils package)" --with-gnu-as if using GNU as (in the binutils package)"
ac_help="$ac_help ac_help="$ac_help
--with-elf if using the ELF object format" --with-elf if using the ELF object format"
ac_help="$ac_help
--with-weak-symbols if weak symbols are available in as and ld"
ac_help="$ac_help ac_help="$ac_help
--enable-libio build in GNU libio instead of GNU stdio" --enable-libio build in GNU libio instead of GNU stdio"
ac_help="$ac_help ac_help="$ac_help
@ -355,7 +353,7 @@ EOF
verbose=yes ;; verbose=yes ;;
-version | --version | --versio | --versi | --vers) -version | --version | --versio | --versi | --vers)
echo "configure generated by autoconf version 2.7" echo "configure generated by autoconf version 2.9"
exit 0 ;; exit 0 ;;
-with-* | --with-*) -with-* | --with-*)
@ -620,14 +618,6 @@ else
elf=no elf=no
fi fi
# Check whether --with-weak-symbols or --without-weak-symbols was given.
if test "${with_weak_symbols+set}" = set; then
withval="$with_weak_symbols"
weak=$withval
else
weak=no
fi
# Check whether --enable-libio or --disable-libio was given. # Check whether --enable-libio or --disable-libio was given.
if test "${enable_libio+set}" = set; then if test "${enable_libio+set}" = set; then
@ -1147,13 +1137,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser, # On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. # not just through cpp.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1151 "configure" #line 1141 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <assert.h> #include <assert.h>
Syntax Error Syntax Error
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1147: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out` ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then if test -z "$ac_err"; then
: :
@ -1162,13 +1152,13 @@ else
rm -rf conftest* rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp" CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1166 "configure" #line 1156 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <assert.h> #include <assert.h>
Syntax Error Syntax Error
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:1162: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out` ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then if test -z "$ac_err"; then
: :
@ -1217,7 +1207,7 @@ if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4 echo $ac_n "(cached) $ac_c" 1>&4
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1221 "configure" #line 1211 "configure"
#include "confdefs.h" #include "confdefs.h"
#define __need_size_t #define __need_size_t
#define __need_wchar_t #define __need_wchar_t
@ -1233,7 +1223,7 @@ size_t size; wchar_t wchar;
if (&size == NULL || &wchar == NULL) abort (); if (&size == NULL || &wchar == NULL) abort ();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1237: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
libc_cv_friendly_stddef=yes libc_cv_friendly_stddef=yes
else else
@ -1340,7 +1330,7 @@ if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4 echo $ac_n "(cached) $ac_c" 1>&4
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1344 "configure" #line 1334 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { return 0; } int main() { return 0; }
@ -1349,7 +1339,7 @@ asm (".section .init");
asm (".section .fini"); asm (".section .fini");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1343: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
libc_cv_have_initfini=yes libc_cv_have_initfini=yes
else else
@ -1369,6 +1359,108 @@ EOF
fi fi
fi fi
if test $elf = yes; then
libc_cv_asm_underscores=no
else
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&4
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
#line 1371 "configure"
#include "confdefs.h"
asm ("_glibc_foobar:");
int main() { return 0; }
int t() {
glibc_foobar ();
; return 0; }
EOF
if { (eval echo configure:1379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_asm_underscores=yes
else
rm -rf conftest*
libc_cv_asm_underscores=no
fi
rm -f conftest*
fi
echo "$ac_t""$libc_cv_asm_underscores" 1>&4
fi
if test $libc_cv_asm_underscores = no; then
cat >> confdefs.h <<\EOF
#define NO_UNDERSCORES 1
EOF
fi
if test $elf = yes; then
libc_cv_weak_symbols=yes
libc_cv_asm_weak_directive=yes
libc_cv_asm_weakext_directive=no
else
echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&4
if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.s <<EOF
.text
${libc_cv_asm_global_directive} foo
foo: .long 0
.weak foo
.weak bar; bar = foo
EOF
if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
libc_cv_asm_weak_directive=yes
else
libc_cv_asm_weak_directive=no
fi
rm -f conftest*
fi
echo "$ac_t""$libc_cv_asm_weak_directive" 1>&4
if $libc_cv_asm_weak_directive = no; then
echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&4
if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.s <<EOF
.text
${libc_cv_asm_global_directive} foo
foo: .long 0
.weakext foo
.weak bar, foo
EOF
if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
libc_cv_asm_weakext_directive=yes
else
libc_cv_asm_weakext_directive=no
fi
rm -f conftest*
fi
echo "$ac_t""$libc_cv_asm_weakext_directive" 1>&4
fi # no .weak
fi # not ELF
if test $libc_cv_asm_weak_directive; then
cat >> confdefs.h <<\EOF
#define HAVE_ASM_WEAK_DIRECTIVE 1
EOF
elif test $libc_cv_asm_weakext_directive; then
cat >> confdefs.h <<\EOF
#define HAVE_ASM_WEAKEXT_DIRECTIVE 1
EOF
fi
### End of automated tests.
### Now run sysdeps configure fragments.
# sysdeps configure fragments may set these with files to be linked below. # sysdeps configure fragments may set these with files to be linked below.
libc_link_dests= libc_link_dests=
libc_link_sources= libc_link_sources=
@ -1456,7 +1548,7 @@ default) stdio=stdio ;;
esac esac
echo "$ac_t""$stdio" 1>&4 echo "$ac_t""$stdio" 1>&4
if test $gnu_ld = yes; then if test $gnu_ld = yes; then
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define HAVE_GNU_LD 1 #define HAVE_GNU_LD 1
@ -1474,12 +1566,6 @@ if test $elf = yes; then
#define HAVE_ELF 1 #define HAVE_ELF 1
EOF EOF
fi
if test $weak = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_WEAK_SYMBOLS 1
EOF
fi fi
@ -1573,7 +1659,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v) -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "$CONFIG_STATUS generated by autoconf version 2.7" echo "$CONFIG_STATUS generated by autoconf version 2.9"
exit 0 ;; exit 0 ;;
-help | --help | --hel | --he | --h) -help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;; echo "\$ac_cs_usage"; exit 0 ;;
@ -1639,7 +1725,6 @@ s%@stdio@%$stdio%g
s%@gnu_ld@%$gnu_ld%g s%@gnu_ld@%$gnu_ld%g
s%@gnu_as@%$gnu_as%g s%@gnu_as@%$gnu_as%g
s%@elf@%$elf%g s%@elf@%$elf%g
s%@weak@%$weak%g
s%@shared@%$shared%g s%@shared@%$shared%g
s%@profile@%$profile%g s%@profile@%$profile%g
s%@omitfp@%$omitfp%g s%@omitfp@%$omitfp%g
@ -1747,7 +1832,7 @@ rm -f conftest.vals
cat > conftest.hdr <<\EOF cat > conftest.hdr <<\EOF
s/[\\&%]/\\&/g s/[\\&%]/\\&/g
s%[\\$`]%\\&%g s%[\\$`]%\\&%g
s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
s%ac_d%ac_u%gp s%ac_d%ac_u%gp
s%ac_u%ac_e%gp s%ac_u%ac_e%gp
EOF EOF

View File

@ -1,6 +1,6 @@
Dnl Process this file with autoconf to produce a configure script. Dnl Process this file with autoconf to produce a configure script.
AC_REVISION([$CVSid$]) AC_REVISION([$CVSid$])
AC_PREREQ(2.4.2)dnl dnl Minimum Autoconf version required. AC_PREREQ(2.9)dnl dnl Minimum Autoconf version required.
AC_INIT(features.h) AC_INIT(features.h)
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
@ -49,9 +49,6 @@ test $gnu_binutils = yes && gnu_as=yes gnu_ld=yes
AC_ARG_WITH(elf, dnl AC_ARG_WITH(elf, dnl
--with-elf if using the ELF object format, --with-elf if using the ELF object format,
elf=$withval, elf=no) elf=$withval, elf=no)
AC_ARG_WITH(weak-symbols, dnl
--with-weak-symbols if weak symbols are available in as and ld,
weak=$withval, weak=no)
AC_ARG_ENABLE(libio, dnl AC_ARG_ENABLE(libio, dnl
[ --enable-libio build in GNU libio instead of GNU stdio], [ --enable-libio build in GNU libio instead of GNU stdio],
@ -406,6 +403,69 @@ if test $elf != yes; then
fi fi
fi fi
if test $elf = yes; then
libc_cv_asm_underscores=no
else
AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
[AC_TRY_COMPILE([asm ("_glibc_foobar:");], [glibc_foobar ();],
libc_cv_asm_underscores=yes,
libc_cv_asm_underscores=no)])
fi
if test $libc_cv_asm_underscores = no; then
AC_DEFINE(NO_UNDERSCORES)
fi
if test $elf = yes; then
libc_cv_weak_symbols=yes
libc_cv_asm_weak_directive=yes
libc_cv_asm_weakext_directive=no
else
AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
[dnl
cat > conftest.s <<EOF
.text
${libc_cv_asm_global_directive} foo
foo: .long 0
.weak foo
.weak bar; bar = foo
EOF
if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
libc_cv_asm_weak_directive=yes
else
libc_cv_asm_weak_directive=no
fi
rm -f conftest*])
if $libc_cv_asm_weak_directive = no; then
AC_CACHE_CHECK(for assembler .weakext directive,
libc_cv_asm_weakext_directive,
[dnl
cat > conftest.s <<EOF
.text
${libc_cv_asm_global_directive} foo
foo: .long 0
.weakext foo
.weak bar, foo
EOF
if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
libc_cv_asm_weakext_directive=yes
else
libc_cv_asm_weakext_directive=no
fi
rm -f conftest*])
fi # no .weak
fi # not ELF
if test $libc_cv_asm_weak_directive; then
AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
elif test $libc_cv_asm_weakext_directive; then
AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
fi
### End of automated tests.
### Now run sysdeps configure fragments.
# sysdeps configure fragments may set these with files to be linked below. # sysdeps configure fragments may set these with files to be linked below.
libc_link_dests= libc_link_dests=
libc_link_sources= libc_link_sources=
@ -498,7 +558,7 @@ default) stdio=stdio ;;
esac esac
AC_MSG_RESULT($stdio) AC_MSG_RESULT($stdio)
AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf) AC_SUBST(weak) AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf)
if test $gnu_ld = yes; then if test $gnu_ld = yes; then
AC_DEFINE(HAVE_GNU_LD) AC_DEFINE(HAVE_GNU_LD)
fi fi
@ -508,9 +568,6 @@ fi
if test $elf = yes; then if test $elf = yes; then
AC_DEFINE(HAVE_ELF) AC_DEFINE(HAVE_ELF)
fi fi
if test $weak = yes; then
AC_DEFINE(HAVE_WEAK_SYMBOLS)
fi
AC_SUBST(shared) AC_SUBST(shared)
if test $shared = default; then if test $shared = default; then

View File

@ -39,14 +39,15 @@
/* External definitions for functions in inet(3) */ /* External definitions for functions in inet(3) */
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS __BEGIN_DECLS
unsigned long inet_addr __P((const char *)); u_int32_t inet_addr __P((const char *));
int inet_aton __P((const char *, struct in_addr *)); int inet_aton __P((const char *, struct in_addr *));
unsigned long inet_lnaof __P((struct in_addr)); u_int32_t inet_lnaof __P((struct in_addr));
struct in_addr inet_makeaddr __P((u_long , u_long)); struct in_addr inet_makeaddr __P((u_int32_t , u_int32_t));
unsigned long inet_netof __P((struct in_addr)); u_int32_t inet_netof __P((struct in_addr));
unsigned long inet_network __P((const char *)); u_int32_t inet_network __P((const char *));
char *inet_ntoa __P((struct in_addr)); char *inet_ntoa __P((struct in_addr));
__END_DECLS __END_DECLS

View File

@ -44,11 +44,11 @@ static char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93";
* internet address; handles class a/b/c network * internet address; handles class a/b/c network
* number formats. * number formats.
*/ */
u_long u_int32_t
inet_lnaof(in) inet_lnaof(in)
struct in_addr in; struct in_addr in;
{ {
register u_long i = ntohl(in.s_addr); register u_int32_t i = ntohl(in.s_addr);
if (IN_CLASSA(i)) if (IN_CLASSA(i))
return ((i)&IN_CLASSA_HOST); return ((i)&IN_CLASSA_HOST);

View File

@ -45,9 +45,9 @@ static char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93";
*/ */
struct in_addr struct in_addr
inet_makeaddr(net, host) inet_makeaddr(net, host)
u_long net, host; u_int32_t net, host;
{ {
u_long addr; u_int32_t addr;
if (net < 128) if (net < 128)
addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);

View File

@ -45,13 +45,13 @@ static char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93";
* The library routines call this routine to interpret * The library routines call this routine to interpret
* network numbers. * network numbers.
*/ */
u_long u_int32_t
inet_network(cp) inet_network(cp)
register const char *cp; register const char *cp;
{ {
register u_long val, base, n; register u_int32_t val, base, n;
register char c; register char c;
u_long parts[4], *pp = parts; u_int32_t parts[4], *pp = parts;
register int i; register int i;
again: again:

View File

@ -43,11 +43,11 @@ static char sccsid[] = "@(#)inet_netof.c 8.1 (Berkeley) 6/4/93";
* Return the network number from an internet * Return the network number from an internet
* address; handles class a/b/c network #'s. * address; handles class a/b/c network #'s.
*/ */
u_long u_int32_t
inet_netof(in) inet_netof(in)
struct in_addr in; struct in_addr in;
{ {
register u_long i = ntohl(in.s_addr); register u_int32_t i = ntohl(in.s_addr);
if (IN_CLASSA(i)) if (IN_CLASSA(i))
return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT); return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT);

View File

@ -89,7 +89,7 @@ enum
/* Internet address. */ /* Internet address. */
struct in_addr struct in_addr
{ {
unsigned long int s_addr; unsigned int s_addr;
}; };
@ -98,33 +98,33 @@ struct in_addr
On subnets, host and network parts are found according to On subnets, host and network parts are found according to
the subnet mask, not these masks. */ the subnet mask, not these masks. */
#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0) #define IN_CLASSA(a) ((((unsigned) (a)) & 0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000 #define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24 #define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) #define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
#define IN_CLASSA_MAX 128 #define IN_CLASSA_MAX 128
#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000) #define IN_CLASSB(a) ((((unsigned) (a)) & 0xc0000000) == 0x80000000)
#define IN_CLASSB_NET 0xffff0000 #define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16 #define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) #define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
#define IN_CLASSB_MAX 65536 #define IN_CLASSB_MAX 65536
#define IN_CLASSC(a) ((((long int) (a)) & 0xc0000000) == 0xc0000000) #define IN_CLASSC(a) ((((unsigned) (a)) & 0xc0000000) == 0xc0000000)
#define IN_CLASSC_NET 0xffffff00 #define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8 #define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) #define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) #define IN_CLASSD(a) ((((unsigned) (a)) & 0xf0000000) == 0xe0000000)
#define IN_MULTICAST(a) IN_CLASSD(a) #define IN_MULTICAST(a) IN_CLASSD(a)
#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xe0000000) == 0xe0000000) #define IN_EXPERIMENTAL(a) ((((unsigned) (a)) & 0xe0000000) == 0xe0000000)
#define IN_BADCLASS(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) #define IN_BADCLASS(a) ((((unsigned) (a)) & 0xf0000000) == 0xf0000000)
/* Address to accept any incoming messages. */ /* Address to accept any incoming messages. */
#define INADDR_ANY ((unsigned long int) 0x00000000) #define INADDR_ANY ((unsigned) 0x00000000)
/* Address to send to all hosts. */ /* Address to send to all hosts. */
#define INADDR_BROADCAST ((unsigned long int) 0xffffffff) #define INADDR_BROADCAST ((unsigned) 0xffffffff)
/* Address indicating an error return. */ /* Address indicating an error return. */
#define INADDR_NONE 0xffffffff #define INADDR_NONE 0xffffffff

View File

@ -33,7 +33,7 @@
* @(#)tcp.h 8.1 (Berkeley) 6/10/93 * @(#)tcp.h 8.1 (Berkeley) 6/10/93
*/ */
typedef u_long tcp_seq; typedef unsigned int tcp_seq;
/* /*
* TCP header. * TCP header.
* Per RFC 793, September, 1981. * Per RFC 793, September, 1981.

View File

@ -36,13 +36,15 @@
#ifndef _RWHOD_H_ #ifndef _RWHOD_H_
#define _RWHOD_H_ #define _RWHOD_H_
#include <sys/types.h>
/* /*
* rwho protocol packet format. * rwho protocol packet format.
*/ */
struct outmp { struct outmp {
char out_line[8]; /* tty name */ char out_line[8]; /* tty name */
char out_name[8]; /* user id */ char out_name[8]; /* user id */
long out_time; /* time on */ int32_t out_time; /* time on */
}; };
struct whod { struct whod {

View File

@ -54,6 +54,8 @@
* stream connection through which the conversation takes place. * stream connection through which the conversation takes place.
*/ */
#include <sys/types.h>
/* /*
* Client->server request message format. * Client->server request message format.
*/ */
@ -62,10 +64,10 @@ typedef struct {
u_char type; /* request type, see below */ u_char type; /* request type, see below */
u_char answer; /* not used */ u_char answer; /* not used */
u_char pad; u_char pad;
u_long id_num; /* message id */ u_int32_t id_num; /* message id */
struct osockaddr addr; /* old (4.3) style */ struct osockaddr addr; /* old (4.3) style */
struct osockaddr ctl_addr; /* old (4.3) style */ struct osockaddr ctl_addr; /* old (4.3) style */
long pid; /* caller's process id */ int32_t pid; /* caller's process id */
#define NAME_SIZE 12 #define NAME_SIZE 12
char l_name[NAME_SIZE];/* caller's name */ char l_name[NAME_SIZE];/* caller's name */
char r_name[NAME_SIZE];/* callee's name */ char r_name[NAME_SIZE];/* callee's name */
@ -81,7 +83,7 @@ typedef struct {
u_char type; /* type of request message, see below */ u_char type; /* type of request message, see below */
u_char answer; /* respose to request message, see below */ u_char answer; /* respose to request message, see below */
u_char pad; u_char pad;
u_long id_num; /* message id */ u_int32_t id_num; /* message id */
struct osockaddr addr; /* address for establishing conversation */ struct osockaddr addr; /* address for establishing conversation */
} CTL_RESPONSE; } CTL_RESPONSE;

View File

@ -52,8 +52,8 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
int __ivaliduser __P((FILE *, u_long, const char *, const char *)); int __ivaliduser __P((FILE *, u_int32_t, const char *, const char *));
static int __icheckhost __P((u_long, char *)); static int __icheckhost __P((u_int32_t, char *));
int int
rcmd(ahost, rport, locuser, remuser, cmd, fd2p) rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
@ -65,7 +65,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
struct hostent *hp; struct hostent *hp;
struct sockaddr_in sin, from; struct sockaddr_in sin, from;
fd_set reads; fd_set reads;
long oldmask; int32_t oldmask;
pid_t pid; pid_t pid;
int s, lport, timo; int s, lport, timo;
char c; char c;
@ -242,7 +242,7 @@ ruserok(rhost, superuser, ruser, luser)
int superuser; int superuser;
{ {
struct hostent *hp; struct hostent *hp;
u_long addr; u_int32_t addr;
char **ap; char **ap;
if ((hp = gethostbyname(rhost)) == NULL) if ((hp = gethostbyname(rhost)) == NULL)
@ -266,7 +266,7 @@ ruserok(rhost, superuser, ruser, luser)
*/ */
int int
iruserok(raddr, superuser, ruser, luser) iruserok(raddr, superuser, ruser, luser)
u_long raddr; u_int32_t raddr;
int superuser; int superuser;
const char *ruser, *luser; const char *ruser, *luser;
{ {
@ -347,7 +347,7 @@ again:
int int
__ivaliduser(hostf, raddr, luser, ruser) __ivaliduser(hostf, raddr, luser, ruser)
FILE *hostf; FILE *hostf;
u_long raddr; u_int32_t raddr;
const char *luser, *ruser; const char *luser, *ruser;
{ {
register char *user, *p; register char *user, *p;
@ -389,15 +389,15 @@ __ivaliduser(hostf, raddr, luser, ruser)
*/ */
static int static int
__icheckhost(raddr, lhost) __icheckhost(raddr, lhost)
u_long raddr; u_int32_t raddr;
register char *lhost; register char *lhost;
{ {
register struct hostent *hp; register struct hostent *hp;
register u_long laddr; register u_int32_t laddr;
register char **pp; register char **pp;
/* Try for raw ip address first. */ /* Try for raw ip address first. */
if (isdigit(*lhost) && (long)(laddr = inet_addr(lhost)) != -1) if (isdigit(*lhost) && (int32_t)(laddr = inet_addr(lhost)) != -1)
return (raddr == laddr); return (raddr == laddr);
/* Better be a hostname. */ /* Better be a hostname. */
@ -406,7 +406,7 @@ __icheckhost(raddr, lhost)
/* Spin through ip addresses. */ /* Spin through ip addresses. */
for (pp = hp->h_addr_list; *pp; ++pp) for (pp = hp->h_addr_list; *pp; ++pp)
if (!bcmp(&raddr, *pp, sizeof(u_long))) if (!bcmp(&raddr, *pp, sizeof(u_int32_t)))
return (1); return (1);
/* No match. */ /* No match. */

View File

@ -27,14 +27,13 @@ Cambridge, MA 02139, USA. */
We include config.h which is generated by configure. We include config.h which is generated by configure.
It should define for us the following symbols: It should define for us the following symbols:
* HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
* ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'.
* HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out, * HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out,
and for symbol set and warning messages extensions in a.out and ELF. and for symbol set and warning messages extensions in a.out and ELF.
This implies HAVE_WEAK_SYMBOLS; set by --with-gnu-ld. * HAVE_ELF if using ELF, which supports weak symbols using `.weak'.
* HAVE_ELF if using ELF, which supports weak symbols. * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'.
This implies HAVE_WEAK_SYMBOLS; set by --with-elf. * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'.
* HAVE_WEAK_SYMBOLS if weak symbols are available in the assembler and
linker being used. Set by --with-weak-symbols.
*/ */
@ -79,23 +78,14 @@ extern const char _libc_intl_domainname[];
/* /*
*/ */
/* The symbols in all the user (non-_) macros are C symbols. Predefined /* The symbols in all the user (non-_) macros are C symbols.
should be HAVE_WEAK_SYMBOLS and/or HAVE_ELF and/or HAVE_GNU_LD. HAVE_GNU_LD without HAVE_ELF implies a.out. */
HAVE_WEAK_SYMBOLS is implied by the other two. HAVE_GNU_LD without
HAVE_ELF implies a.out. */
#ifndef HAVE_WEAK_SYMBOLS #if defined (HAVE_ASM_WEAK_DIRECTIVE) || defined (HAVE_ASM_WEAKEXT_DIRECTIVE)
#if defined (HAVE_ELF) || defined (HAVE_GNU_LD)
#define HAVE_WEAK_SYMBOLS #define HAVE_WEAK_SYMBOLS
#endif #endif
#endif
#ifndef __SYMBOL_PREFIX #ifndef __SYMBOL_PREFIX
#ifdef HAVE_ELF
#define NO_UNDERSCORES
#else
#include <sysdep.h> /* Should define NO_UNDERSCORES. */
#endif
#ifdef NO_UNDERSCORES #ifdef NO_UNDERSCORES
#define __SYMBOL_PREFIX #define __SYMBOL_PREFIX
#else #else
@ -143,8 +133,21 @@ extern const char _libc_intl_domainname[];
#ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_WEAK_SYMBOLS
#ifdef ASSEMBLER #ifdef ASSEMBLER
#ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
/* Define ALIAS as a weak alias for ORIGINAL.
If weak aliases are not available, this defines a strong alias. */
#define weak_alias(original, alias) \
.weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
/* Declare SYMBOL to be weak. */
#define weak_symbol(symbol) .weakext C_SYMBOL_NAME (symbol)
#else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
/* Define ALIAS as a weak alias for ORIGINAL. /* Define ALIAS as a weak alias for ORIGINAL.
If weak aliases are not available, this defines a strong alias. */ If weak aliases are not available, this defines a strong alias. */
#define weak_alias(original, alias) \ #define weak_alias(original, alias) \
@ -154,12 +157,21 @@ extern const char _libc_intl_domainname[];
/* Declare SYMBOL to be weak. */ /* Declare SYMBOL to be weak. */
#define weak_symbol(symbol) .weak C_SYMBOL_NAME (symbol) #define weak_symbol(symbol) .weak C_SYMBOL_NAME (symbol)
#else #endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
#else /* ! ASSEMBLER */
#ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
#define weak_symbol(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol);
#define weak_alias(original, alias) \
asm (".weakext " __SYMBOL_PREFIX #alias ", " __SYMBOL_PREFIX #original);
#else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
#define weak_symbol(symbol) asm (".weak " __SYMBOL_PREFIX #symbol); #define weak_symbol(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
#define weak_alias(original, alias) \ #define weak_alias(original, alias) \
asm (".weak " __SYMBOL_PREFIX #alias "\n" \ asm (".weak " __SYMBOL_PREFIX #alias "\n" \
__SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original); __SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original);
#endif #endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
#endif /* ! ASSEMBLER */
#else #else
#define weak_alias(original, alias) strong_alias(original, alias) #define weak_alias(original, alias) strong_alias(original, alias)
#define weak_symbol(symbol) /* Do nothing. */ #define weak_symbol(symbol) /* Do nothing. */

View File

@ -70,7 +70,7 @@ static char rcsid[] = "$Id$";
* Ascii internet address interpretation routine. * Ascii internet address interpretation routine.
* The value returned is in network order. * The value returned is in network order.
*/ */
u_long u_int32_t
inet_addr(cp) inet_addr(cp)
register const char *cp; register const char *cp;
{ {
@ -93,7 +93,7 @@ inet_aton(cp, addr)
register const char *cp; register const char *cp;
struct in_addr *addr; struct in_addr *addr;
{ {
register u_long val; register u_int32_t val;
register int base, n; register int base, n;
register char c; register char c;
u_int parts[4]; u_int parts[4];

View File

@ -62,14 +62,10 @@ enum auth_stat {
AUTH_FAILED=7 /* some unknown reason */ AUTH_FAILED=7 /* some unknown reason */
}; };
#if 1 /* (mc68000 || sparc || vax || i386) --roland@gnu */
typedef u_long u_int32; /* 32-bit unsigned integers */
#endif
union des_block { union des_block {
struct { struct {
u_int32 high; u_int32_t high;
u_int32 low; u_int32_t low;
} key; } key;
char c[8]; char c[8];
}; };

View File

@ -83,7 +83,7 @@ _svcauth_unix(rqst, msg)
bcopy((caddr_t)buf, aup->aup_machname, (u_int)str_len); bcopy((caddr_t)buf, aup->aup_machname, (u_int)str_len);
aup->aup_machname[str_len] = 0; aup->aup_machname[str_len] = 0;
str_len = RNDUP(str_len); str_len = RNDUP(str_len);
buf += str_len / sizeof (long); buf = (u_long *) ((char *) buf + str_len);
aup->aup_uid = IXDR_GET_LONG(buf); aup->aup_uid = IXDR_GET_LONG(buf);
aup->aup_gid = IXDR_GET_LONG(buf); aup->aup_gid = IXDR_GET_LONG(buf);
gid_len = IXDR_GET_U_LONG(buf); gid_len = IXDR_GET_U_LONG(buf);

View File

@ -42,7 +42,7 @@ static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
* and the tcp transport level. A record is composed on one or more * and the tcp transport level. A record is composed on one or more
* record fragments. A record fragment is a thirty-two bit header followed * record fragments. A record fragment is a thirty-two bit header followed
* by n bytes of data, where n is contained in the header. The header * by n bytes of data, where n is contained in the header. The header
* is represented as a htonl(u_long). Thegh order bit encodes * is represented as a htonl(u_long). The high order bit encodes
* whether or not the fragment is the last fragment of the record * whether or not the fragment is the last fragment of the record
* (1 => fragment is last, 0 => more fragments to follow. * (1 => fragment is last, 0 => more fragments to follow.
* The other 31 bits encode the byte length of the fragment. * The other 31 bits encode the byte length of the fragment.
@ -90,7 +90,7 @@ static struct xdr_ops xdrrec_ops = {
* meet the needs of xdr and rpc based on tcp. * meet the needs of xdr and rpc based on tcp.
*/ */
#define LAST_FRAG ((u_long)(1 << 31)) #define LAST_FRAG (1UL << 31)
typedef struct rec_strm { typedef struct rec_strm {
caddr_t tcp_handle; caddr_t tcp_handle;
@ -102,7 +102,7 @@ typedef struct rec_strm {
caddr_t out_base; /* output buffer (points to frag header) */ caddr_t out_base; /* output buffer (points to frag header) */
caddr_t out_finger; /* next output position */ caddr_t out_finger; /* next output position */
caddr_t out_boundry; /* data cannot up to this address */ caddr_t out_boundry; /* data cannot up to this address */
u_long *frag_header; /* beginning of curren fragment */ u_int32_t *frag_header; /* beginning of curren fragment */
bool_t frag_sent; /* true if buffer sent in middle of record */ bool_t frag_sent; /* true if buffer sent in middle of record */
/* /*
* in-coming bits * in-coming bits
@ -171,8 +171,8 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
rstrm->readit = readit; rstrm->readit = readit;
rstrm->writeit = writeit; rstrm->writeit = writeit;
rstrm->out_finger = rstrm->out_boundry = rstrm->out_base; rstrm->out_finger = rstrm->out_boundry = rstrm->out_base;
rstrm->frag_header = (u_long *)rstrm->out_base; rstrm->frag_header = (u_int32_t *)rstrm->out_base;
rstrm->out_finger += sizeof(u_long); rstrm->out_finger += 4;
rstrm->out_boundry += sendsize; rstrm->out_boundry += sendsize;
rstrm->frag_sent = FALSE; rstrm->frag_sent = FALSE;
rstrm->in_size = recvsize; rstrm->in_size = recvsize;
@ -193,22 +193,24 @@ xdrrec_getlong(xdrs, lp)
XDR *xdrs; XDR *xdrs;
long *lp; long *lp;
{ {
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
register long *buflp = (long *)(rstrm->in_finger); register int32_t *buflp = (int32_t *) rstrm->in_finger;
long mylong; int32_t mylong;
/* first try the inline, fast case */ /* first try the inline, fast case */
if ((rstrm->fbtbc >= sizeof(long)) && if (rstrm->fbtbc >= BYTES_PER_XDR_UNIT &&
(((int)rstrm->in_boundry - (int)buflp) >= sizeof(long))) { rstrm->in_boundry - (char *) buflp >= BYTES_PER_XDR_UNIT)
*lp = (long)ntohl((u_long)(*buflp)); {
rstrm->fbtbc -= sizeof(long); *lp = ntohl(*buflp);
rstrm->in_finger += sizeof(long); rstrm->fbtbc -= BYTES_PER_XDR_UNIT;
rstrm->in_finger += BYTES_PER_XDR_UNIT;
} else { } else {
if (! xdrrec_getbytes(xdrs, (caddr_t)&mylong, sizeof(long))) if (! xdrrec_getbytes(xdrs, (caddr_t) &mylong,
return (FALSE); BYTES_PER_XDR_UNIT))
*lp = (long)ntohl((u_long)mylong); return FALSE;
*lp = ntohl(mylong);
} }
return (TRUE); return TRUE;
} }
static bool_t static bool_t
@ -216,23 +218,23 @@ xdrrec_putlong(xdrs, lp)
XDR *xdrs; XDR *xdrs;
long *lp; long *lp;
{ {
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
register long *dest_lp = ((long *)(rstrm->out_finger)); register int32_t *dest_lp = (int32_t *) rstrm->out_finger;
if ((rstrm->out_finger += sizeof(long)) > rstrm->out_boundry) { if ((rstrm->out_finger += BYTES_PER_XDR_UNIT) > rstrm->out_boundry) {
/* /*
* this case should almost never happen so the code is * this case should almost never happen so the code is
* inefficient * inefficient
*/ */
rstrm->out_finger -= sizeof(long); rstrm->out_finger -= BYTES_PER_XDR_UNIT;
rstrm->frag_sent = TRUE; rstrm->frag_sent = TRUE;
if (! flush_out(rstrm, FALSE)) if (! flush_out(rstrm, FALSE))
return (FALSE); return FALSE;
dest_lp = ((long *)(rstrm->out_finger)); dest_lp = (int32_t *) rstrm->out_finger;
rstrm->out_finger += sizeof(long); rstrm->out_finger += BYTES_PER_XDR_UNIT;
} }
*dest_lp = (long)htonl((u_long)(*lp)); *dest_lp = htonl(*lp);
return (TRUE); return TRUE;
} }
static bool_t /* must manage buffers, fragments, and records */ static bool_t /* must manage buffers, fragments, and records */
@ -241,26 +243,26 @@ xdrrec_getbytes(xdrs, addr, len)
register caddr_t addr; register caddr_t addr;
register u_int len; register u_int len;
{ {
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
register int current; register int current;
while (len > 0) { while (len > 0) {
current = rstrm->fbtbc; current = rstrm->fbtbc;
if (current == 0) { if (current == 0) {
if (rstrm->last_frag) if (rstrm->last_frag)
return (FALSE); return FALSE;
if (! set_input_fragment(rstrm)) if (! set_input_fragment(rstrm))
return (FALSE); return FALSE;
continue; continue;
} }
current = (len < current) ? len : current; current = (len < current) ? len : current;
if (! get_input_bytes(rstrm, addr, current)) if (! get_input_bytes(rstrm, addr, current))
return (FALSE); return FALSE;
addr += current; addr += current;
rstrm->fbtbc -= current; rstrm->fbtbc -= current;
len -= current; len -= current;
} }
return (TRUE); return TRUE;
} }
static bool_t static bool_t
@ -269,11 +271,11 @@ xdrrec_putbytes(xdrs, addr, len)
register caddr_t addr; register caddr_t addr;
register u_int len; register u_int len;
{ {
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
register int current; register int current;
while (len > 0) { while (len > 0) {
current = (u_int)rstrm->out_boundry - (u_int)rstrm->out_finger; current = rstrm->out_boundry - rstrm->out_finger;
current = (len < current) ? len : current; current = (len < current) ? len : current;
bcopy(addr, rstrm->out_finger, current); bcopy(addr, rstrm->out_finger, current);
rstrm->out_finger += current; rstrm->out_finger += current;
@ -282,10 +284,10 @@ xdrrec_putbytes(xdrs, addr, len)
if (rstrm->out_finger == rstrm->out_boundry) { if (rstrm->out_finger == rstrm->out_boundry) {
rstrm->frag_sent = TRUE; rstrm->frag_sent = TRUE;
if (! flush_out(rstrm, FALSE)) if (! flush_out(rstrm, FALSE))
return (FALSE); return FALSE;
} }
} }
return (TRUE); return TRUE;
} }
static u_int static u_int
@ -319,7 +321,7 @@ xdrrec_setpos(xdrs, pos)
register XDR *xdrs; register XDR *xdrs;
u_int pos; u_int pos;
{ {
register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
u_int currpos = xdrrec_getpos(xdrs); u_int currpos = xdrrec_getpos(xdrs);
int delta = currpos - pos; int delta = currpos - pos;
caddr_t newpos; caddr_t newpos;
@ -329,10 +331,11 @@ xdrrec_setpos(xdrs, pos)
case XDR_ENCODE: case XDR_ENCODE:
newpos = rstrm->out_finger - delta; newpos = rstrm->out_finger - delta;
if ((newpos > (caddr_t)(rstrm->frag_header)) && if (newpos > (caddr_t) rstrm->frag_header &&
(newpos < rstrm->out_boundry)) { newpos < rstrm->out_boundry)
{
rstrm->out_finger = newpos; rstrm->out_finger = newpos;
return (TRUE); return TRUE;
} }
break; break;
@ -343,11 +346,11 @@ xdrrec_setpos(xdrs, pos)
(newpos >= rstrm->in_base)) { (newpos >= rstrm->in_base)) {
rstrm->in_finger = newpos; rstrm->in_finger = newpos;
rstrm->fbtbc -= delta; rstrm->fbtbc -= delta;
return (TRUE); return TRUE;
} }
break; break;
} }
return (FALSE); return FALSE;
} }
static long * static long *
@ -355,7 +358,7 @@ xdrrec_inline(xdrs, len)
register XDR *xdrs; register XDR *xdrs;
int len; int len;
{ {
register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
long * buf = NULL; long * buf = NULL;
switch (xdrs->x_op) { switch (xdrs->x_op) {
@ -376,7 +379,7 @@ xdrrec_inline(xdrs, len)
} }
break; break;
} }
return (buf); return buf;
} }
static void static void
@ -403,17 +406,17 @@ bool_t
xdrrec_skiprecord(xdrs) xdrrec_skiprecord(xdrs)
XDR *xdrs; XDR *xdrs;
{ {
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) { while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) {
if (! skip_input_bytes(rstrm, rstrm->fbtbc)) if (! skip_input_bytes(rstrm, rstrm->fbtbc))
return (FALSE); return FALSE;
rstrm->fbtbc = 0; rstrm->fbtbc = 0;
if ((! rstrm->last_frag) && (! set_input_fragment(rstrm))) if ((! rstrm->last_frag) && (! set_input_fragment(rstrm)))
return (FALSE); return FALSE;
} }
rstrm->last_frag = FALSE; rstrm->last_frag = FALSE;
return (TRUE); return TRUE;
} }
/* /*
@ -425,18 +428,18 @@ bool_t
xdrrec_eof(xdrs) xdrrec_eof(xdrs)
XDR *xdrs; XDR *xdrs;
{ {
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) { while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) {
if (! skip_input_bytes(rstrm, rstrm->fbtbc)) if (! skip_input_bytes(rstrm, rstrm->fbtbc))
return (TRUE); return TRUE;
rstrm->fbtbc = 0; rstrm->fbtbc = 0;
if ((! rstrm->last_frag) && (! set_input_fragment(rstrm))) if ((! rstrm->last_frag) && (! set_input_fragment(rstrm)))
return (TRUE); return TRUE;
} }
if (rstrm->in_finger == rstrm->in_boundry) if (rstrm->in_finger == rstrm->in_boundry)
return (TRUE); return TRUE;
return (FALSE); return FALSE;
} }
/* /*
@ -450,21 +453,21 @@ xdrrec_endofrecord(xdrs, sendnow)
XDR *xdrs; XDR *xdrs;
bool_t sendnow; bool_t sendnow;
{ {
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
register u_long len; /* fragment length */ register u_long len; /* fragment length */
if (sendnow || rstrm->frag_sent || if (sendnow || rstrm->frag_sent
((u_long)rstrm->out_finger + sizeof(u_long) >= || rstrm->out_finger + BYTES_PER_XDR_UNIT >= rstrm->out_boundry)
(u_long)rstrm->out_boundry)) { {
rstrm->frag_sent = FALSE; rstrm->frag_sent = FALSE;
return (flush_out(rstrm, TRUE)); return flush_out(rstrm, TRUE);
} }
len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->frag_header) - len = (rstrm->out_finger - (char *) rstrm->frag_header
sizeof(u_long); - BYTES_PER_XDR_UNIT);
*(rstrm->frag_header) = htonl((u_long)len | LAST_FRAG); *rstrm->frag_header = htonl((u_long)len | LAST_FRAG);
rstrm->frag_header = (u_long *)rstrm->out_finger; rstrm->frag_header = (u_int32_t *) rstrm->out_finger;
rstrm->out_finger += sizeof(u_long); rstrm->out_finger += BYTES_PER_XDR_UNIT;
return (TRUE); return TRUE;
} }
@ -477,17 +480,18 @@ flush_out(rstrm, eor)
bool_t eor; bool_t eor;
{ {
register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0; register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0;
register u_long len = (u_long)(rstrm->out_finger) - register u_long len = (rstrm->out_finger
(u_long)(rstrm->frag_header) - sizeof(u_long); - (char *) rstrm->frag_header
- BYTES_PER_XDR_UNIT);
*(rstrm->frag_header) = htonl(len | eormask); *rstrm->frag_header = htonl(len | eormask);
len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->out_base); len = rstrm->out_finger - rstrm->out_base;
if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len) if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len)
!= (int)len) != (int)len)
return (FALSE); return FALSE;
rstrm->frag_header = (u_long *)rstrm->out_base; rstrm->frag_header = (u_int32_t *) rstrm->out_base;
rstrm->out_finger = (caddr_t)rstrm->out_base + sizeof(u_long); rstrm->out_finger = (caddr_t) rstrm->out_base + BYTES_PER_XDR_UNIT;
return (TRUE); return TRUE;
} }
static bool_t /* knows nothing about records! Only about input buffers */ static bool_t /* knows nothing about records! Only about input buffers */
@ -503,11 +507,11 @@ fill_input_buf(rstrm)
where += i; where += i;
len = rstrm->in_size - i; len = rstrm->in_size - i;
if ((len = (*(rstrm->readit))(rstrm->tcp_handle, where, len)) == -1) if ((len = (*(rstrm->readit))(rstrm->tcp_handle, where, len)) == -1)
return (FALSE); return FALSE;
rstrm->in_finger = where; rstrm->in_finger = where;
where += len; where += len;
rstrm->in_boundry = where; rstrm->in_boundry = where;
return (TRUE); return TRUE;
} }
static bool_t /* knows nothing about records! Only about input buffers */ static bool_t /* knows nothing about records! Only about input buffers */
@ -519,10 +523,10 @@ get_input_bytes(rstrm, addr, len)
register int current; register int current;
while (len > 0) { while (len > 0) {
current = (int)rstrm->in_boundry - (int)rstrm->in_finger; current = rstrm->in_boundry - rstrm->in_finger;
if (current == 0) { if (current == 0) {
if (! fill_input_buf(rstrm)) if (! fill_input_buf(rstrm))
return (FALSE); return FALSE;
continue; continue;
} }
current = (len < current) ? len : current; current = (len < current) ? len : current;
@ -531,7 +535,7 @@ get_input_bytes(rstrm, addr, len)
addr += current; addr += current;
len -= current; len -= current;
} }
return (TRUE); return TRUE;
} }
static bool_t /* next two bytes of the input stream are treated as a header */ static bool_t /* next two bytes of the input stream are treated as a header */
@ -540,12 +544,12 @@ set_input_fragment(rstrm)
{ {
u_long header; u_long header;
if (! get_input_bytes(rstrm, (caddr_t)&header, sizeof(header))) if (! get_input_bytes(rstrm, (caddr_t)&header, BYTES_PER_XDR_UNIT))
return (FALSE); return FALSE;
header = (long)ntohl(header); header = ntohl(header);
rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE; rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE;
rstrm->fbtbc = header & (~LAST_FRAG); rstrm->fbtbc = header & ~LAST_FRAG;
return (TRUE); return TRUE;
} }
static bool_t /* consumes input bytes; knows nothing about records! */ static bool_t /* consumes input bytes; knows nothing about records! */
@ -556,17 +560,17 @@ skip_input_bytes(rstrm, cnt)
register int current; register int current;
while (cnt > 0) { while (cnt > 0) {
current = (int)rstrm->in_boundry - (int)rstrm->in_finger; current = rstrm->in_boundry - rstrm->in_finger;
if (current == 0) { if (current == 0) {
if (! fill_input_buf(rstrm)) if (! fill_input_buf(rstrm))
return (FALSE); return FALSE;
continue; continue;
} }
current = (cnt < current) ? cnt : current; current = (cnt < current) ? cnt : current;
rstrm->in_finger += current; rstrm->in_finger += current;
cnt -= current; cnt -= current;
} }
return (TRUE); return TRUE;
} }
static u_int static u_int
@ -576,5 +580,5 @@ fix_buf_size(s)
if (s < 100) if (s < 100)
s = 4000; s = 4000;
return (RNDUP(s)); return RNDUP(s);
} }