forked from Imagelibrary/rtems
Patch from Ralf Corsepius <corsepiu@faw.uni-ulm.de>:
The patch below actuallly consists of two patches: 1) moving librpc to c/src/librpc similar to what has been done to librtems++ 2) reworked configure scripts, many safety and dependency checks added to aclocal/*.m4 macros + configuration fixes. To apply: mkdir c/src/librpc mkdir c/src/librpc/src cp c/src/lib/librpc/*.c c/src/librpc/src cp c/src/lib/librpc/Makefile.in c/src/librpc/src mkdir c/src/librpc/include mkdir c/src/librpc/include/rpc cp c/src/lib/include/rpc/* c/src/librpc/include/rpc patch -p1 < ../rtems-rc-19990820-7.diff rm -rf c/src/lib/librpc rm -rf c/src/lib/include/rpc ./autogen The additional checks in aclocal/*m4 macros add rather restrictive, sometimes unnecessarily restrictive constraints on the sequence of how macros can be used in a configure.in script. Adding them has let my problems with some more complicated configuration options vanish. Apparently some macros had not been in the required order . ---- Now I still get some linking errors for some cpus and bsps, esp when linking cdtest, but also at other locations: e.g. this happens for mips64orion/p4600: # make[5]: Entering directory `/lfs/poseidon/users/rtems/src/multi/build/mips64orion-rtems/c/p4600/tests/samples/hello' /opt/rtems/bin/mips64orion-rtems-gcc --pipe -B../../../../../../p4600/lib/ -specs bsp_specs -qrtems -DP4000 -DCPU_R4000 -DP3_DIAG -D_R4000 -D__mips=3 -mcpu=4600 -G0 -I../../../../../../p4600/lib/include/networking -g -Wall -ansi -fasm -O4 -fomit-frame-pointer -o o-p4600/hello.exe o-p4600/init.o ../../../../../../p4600/lib/no-dpmem.rel ../../../../../../p4600/lib/no-event.rel ../../../../../../p4600/lib/no-msg.rel ../../../../../../p4600/lib/no-mp.rel ../../../../../../p4600/lib/no-part.rel ../../../../../../p4600/lib/no-signal.rel ../../../../../../p4600/lib/no-timer.rel ../../../../../../p4600/lib/no-rtmon.rel /opt/rtems/mips64orion-rtems/lib/libc.a(dtoa.o): In function `_dtoa_r': /opt/hermes/embedded/build/build-mips64orion-tools/mips64orion-rtems/newlib/libc/stdlib/../../../../../src/newlib/libc/stdlib/dtoa.c:348: relocation truncated to fit: R_MIPS_LITERAL no symbol /opt/hermes/embedded/build/build-mips64orion-tools/mips64orion-rtems/newlib/libc/stdlib/../../../../../src/newlib/libc/stdlib/dtoa.c:348: relocation truncated to fit: R_MIPS_LITERAL no symbol /opt/hermes/embedded/build/build-mips64orion-tools/mips64orion-rtems/newlib/libc/stdlib/../../../../../src/newlib/libc/stdlib/dtoa.c:348: relocation truncated to fit: R_MIPS_LITERAL no symbol collect2: ld returned 1 exit status # mips64orion-rtems-gcc -v Reading specs from /opt/rtems/lib/gcc-lib/mips64orion-rtems/2.95.1/specs gcc version 2.95.1 19990816 (release) # mips64orion-rtems-ld -v GNU ld version 2.9.5 (with BFD 2.9.5)
This commit is contained in:
@@ -32,7 +32,7 @@ for i in $rtems_bsp; do
|
||||
|
||||
# Is there code where there should be for this BSP?
|
||||
# The bare bsp is a special case as it is not under the RTEMS_CPU path
|
||||
case $i in
|
||||
case $bspdir in
|
||||
bare)
|
||||
bspcpudir=
|
||||
if test "X${BARE_CPU_CFLAGS}" = "X" ; then
|
||||
|
||||
@@ -8,30 +8,35 @@ RTEMS_TOP(../..)
|
||||
AC_CONFIG_AUX_DIR(../..)
|
||||
|
||||
RTEMS_ENABLE_CXX
|
||||
RTEMS_ENABLE_NETWORKING
|
||||
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
RTEMS_CANONICAL_HOST
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-c-src,$RTEMS_VERSION,no)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
RTEMS_ENV_RTEMSBSP
|
||||
RTEMS_CHECK_CPU
|
||||
RTEMS_CANONICAL_HOST
|
||||
|
||||
RTEMS_PROJECT_ROOT
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
|
||||
## Note: the order of the directories below is essential
|
||||
AC_CONFIG_SUBDIRS(make)
|
||||
AC_CONFIG_SUBDIRS(exec)
|
||||
AC_CONFIG_SUBDIRS(lib)
|
||||
if test "$HAS_NETWORKING" = "yes"; then
|
||||
cfg_subdirs="librpc"
|
||||
fi
|
||||
if test "$RTEMS_HAS_CPLUSPLUS" = "yes"; then
|
||||
cfg_subdirs="librtems++";
|
||||
cfg_subdirs="$cfg_subdirs librtems++";
|
||||
fi
|
||||
AC_CONFIG_SUBDIRS($cfg_subdirs)
|
||||
AC_CONFIG_SUBDIRS(tests)
|
||||
|
||||
RTEMS_PROJECT_ROOT
|
||||
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
)
|
||||
|
||||
@@ -6,10 +6,9 @@ AUTOMAKE_OPTIONS = foreign 1.4
|
||||
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
|
||||
|
||||
if HAS_NETWORKING
|
||||
## We only build the networking and the rpc library
|
||||
## We only build the networking library
|
||||
## if HAS_NETWORKING was defined
|
||||
LIBNETWORKING = libnetworking
|
||||
LIBRPC = librpc
|
||||
|
||||
if HAS_RDBG
|
||||
LIBRDBG = librdbg
|
||||
@@ -22,7 +21,7 @@ LIBCHIP = libchip
|
||||
endif
|
||||
|
||||
SUBDIRS = start include libmisc libc $(LIBNETWORKING) libcpu libbsp \
|
||||
$(LIBRPC) $(LIBRDBG) $(LIBCHIP) $(LIBHWAPI) wrapup
|
||||
$(LIBRDBG) $(LIBCHIP) $(LIBHWAPI) wrapup
|
||||
|
||||
include $(top_srcdir)/../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../automake/local.am
|
||||
|
||||
@@ -6,10 +6,9 @@ AUTOMAKE_OPTIONS = foreign 1.4
|
||||
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
|
||||
|
||||
if HAS_NETWORKING
|
||||
## We only build the networking and the rpc library
|
||||
## We only build the networking library
|
||||
## if HAS_NETWORKING was defined
|
||||
LIBNETWORKING = libnetworking
|
||||
LIBRPC = librpc
|
||||
|
||||
if HAS_RDBG
|
||||
LIBRDBG = librdbg
|
||||
@@ -22,7 +21,7 @@ LIBCHIP = libchip
|
||||
endif
|
||||
|
||||
SUBDIRS = start include libmisc libc $(LIBNETWORKING) libcpu libbsp \
|
||||
$(LIBRPC) $(LIBRDBG) $(LIBCHIP) $(LIBHWAPI) wrapup
|
||||
$(LIBRDBG) $(LIBCHIP) $(LIBHWAPI) wrapup
|
||||
|
||||
include $(top_srcdir)/../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../automake/local.am
|
||||
|
||||
@@ -37,8 +37,6 @@ RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_CHECK_MULTIPROCESSING(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
AM_CONDITIONAL(UNIX,test "$RTEMS_CPU" = "unix")
|
||||
|
||||
# find all the CPU dependent library Makefiles
|
||||
@@ -48,7 +46,6 @@ AC_CONFIG_SUBDIRS(libbsp)
|
||||
# If the TCP/IP stack is enabled, then find all TCP/IP Makefiles
|
||||
if test "$HAS_NETWORKING" = "yes"; then
|
||||
cfg_subdirs="$cfg_subdirs libnetworking"
|
||||
cfg_subdirs="$cfg_subdirs librpc"
|
||||
|
||||
if test "$RTEMS_HAS_RDBG" = "yes"; then
|
||||
RTEMS_CHECK_RDBG(RTEMS_BSP)
|
||||
@@ -99,7 +96,6 @@ include/Makefile
|
||||
include/sys/Makefile
|
||||
include/motorola/Makefile
|
||||
include/zilog/Makefile
|
||||
include/rpc/Makefile
|
||||
include/rdbg/Makefile
|
||||
include/rdbg/i386/Makefile
|
||||
include/rdbg/powerpc/Makefile
|
||||
|
||||
@@ -22,7 +22,7 @@ all-am: $(TMPINSTALL_FILES)
|
||||
debug-am: $(TMPINSTALL_FILES)
|
||||
profile-am: $(TMPINSTALL_FILES)
|
||||
|
||||
SUBDIRS = sys motorola zilog rpc rdbg
|
||||
SUBDIRS = sys motorola zilog rdbg
|
||||
|
||||
include $(top_srcdir)/../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../automake/local.am
|
||||
|
||||
@@ -47,7 +47,7 @@ RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# Is there code where there should be for this BSP?
|
||||
# The bare bsp is a special case as it is not under the RTEMS_CPU path
|
||||
case ${RTEMS_BSP} in
|
||||
case $bspdir in
|
||||
bare)
|
||||
bspcpudir=
|
||||
if test "X${BARE_CPU_CFLAGS}" = "X" ; then
|
||||
|
||||
@@ -3,9 +3,9 @@ dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT(print_dump.c)
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../../../../..)
|
||||
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-lib-libbsp-hppa-simhppa-tools,$RTEMS_VERSION,no)
|
||||
|
||||
@@ -3,9 +3,9 @@ dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT(Spec.doc)
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../../../../..)
|
||||
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-lib-libbsp-i386-pc386-tools,$RTEMS_VERSION,no)
|
||||
|
||||
@@ -3,9 +3,9 @@ dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT(coff2bin)
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../../../../..)
|
||||
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-lib-libbsp-i386-ts_386ex-tools,$RTEMS_VERSION,no)
|
||||
|
||||
@@ -3,9 +3,9 @@ dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT(sload.c)
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../../../../..)
|
||||
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-lib-libbsp-m68k-mvme162-tools,$RTEMS_VERSION,no)
|
||||
|
||||
@@ -3,9 +3,9 @@ dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT(psim)
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../../../../..)
|
||||
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-lib-libbsp-powerpc-psim-tools,$RTEMS_VERSION,no)
|
||||
|
||||
@@ -3,9 +3,9 @@ dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT(runtest.in)
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../../../../..)
|
||||
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-lib-libbsp-sparc-erc32-tools,$RTEMS_VERSION,no)
|
||||
|
||||
@@ -3,9 +3,9 @@ dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT(runtest.in)
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../../../../..)
|
||||
|
||||
RTEMS_TOP(../../../../../../..)
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-lib-libbsp-unix-posix-tools,$RTEMS_VERSION,no)
|
||||
|
||||
@@ -29,8 +29,6 @@ RTEMS_CANONICALIZE_TOOLS
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# pick up all the Makefiles in required parts of the tree
|
||||
if test "$RTEMS_CPU" = "unix"; then
|
||||
## HACK: Suppress libchip for unix
|
||||
|
||||
@@ -30,8 +30,6 @@ RTEMS_CANONICALIZE_TOOLS
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# find all the CPU dependent library Makefiles
|
||||
RTEMS_CHECK_MAKEFILE($RTEMS_CPU)
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ RTEMS_CANONICALIZE_TOOLS
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# try to explicitly list a Makefile here
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
|
||||
@@ -15,6 +15,7 @@ AC_PROG_INSTALL
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
RTEMS_ENABLE_NETWORKING
|
||||
RTEMS_ENABLE_RDBG
|
||||
RTEMS_ENABLE_LIBCDIR
|
||||
RTEMS_ENABLE_BARE
|
||||
|
||||
@@ -40,10 +41,9 @@ if test "$AWK" = "no"; then
|
||||
fi
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
RTEMS_CHECK_RDBG(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
RTEMS_CHECK_RDBG(bspdir)
|
||||
|
||||
# Try to explicitly list a Makefile here
|
||||
AC_OUTPUT(
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = .
|
||||
|
||||
RTEMS_ROOT = @RTEMS_ROOT@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
VPATH = @srcdir@
|
||||
|
||||
LIBNAME = librpc.a
|
||||
LIB = ${ARCH}/${LIBNAME}
|
||||
|
||||
# C and C++ source names, if any, go here -- minus the .c or .cc
|
||||
C_PIECES = rpc_callmsg rpc_prot svc svc_auth svc_udp xdr xdr_array xdr_mem
|
||||
C_FILES = $(C_PIECES:%=%.c)
|
||||
C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
SRCS = $(C_FILES)
|
||||
OBJS = $(C_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(RTEMS_ROOT)/make/lib.cfg
|
||||
|
||||
INSTALL_CHANGE = @INSTALL_CHANGE@
|
||||
|
||||
#
|
||||
# Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS += $(LIBC_DEFINES)
|
||||
|
||||
#
|
||||
# Add your list of files to delete here. The config files
|
||||
# already know how to delete some stuff, so you may want
|
||||
# to just run 'make clean' first to see what gets missed.
|
||||
# 'make clobber' already includes 'make clean'
|
||||
#
|
||||
|
||||
CLEAN_ADDITIONS += $(LIB)
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
all: ${ARCH} $(LIB)
|
||||
$(INSTALL_VARIANT) -m 644 ${LIB} $(PROJECT_RELEASE)/lib
|
||||
|
||||
$(LIB): $(SRCS) ${OBJS}
|
||||
$(make-library)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
653
c/src/lib/librpc/aclocal.m4
vendored
653
c/src/lib/librpc/aclocal.m4
vendored
@@ -1,653 +0,0 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.4a
|
||||
|
||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
dnl PARTICULAR PURPOSE.
|
||||
|
||||
dnl $Id$
|
||||
|
||||
dnl
|
||||
dnl RTEMS_TOP($1)
|
||||
dnl
|
||||
dnl $1 .. relative path from this configure.in to the toplevel configure.in
|
||||
dnl
|
||||
AC_DEFUN(RTEMS_TOP,
|
||||
[dnl
|
||||
AC_ARG_WITH(target-subdir,
|
||||
[ --with-target-subdir=DIR],
|
||||
TARGET_SUBDIR="$withval",
|
||||
TARGET_SUBDIR=".")
|
||||
|
||||
RTEMS_TOPdir="$1";
|
||||
AC_SUBST(RTEMS_TOPdir)
|
||||
|
||||
dnl Determine RTEMS Version string from the VERSION file
|
||||
dnl Hopefully, Joel never changes its format ;-
|
||||
AC_MSG_CHECKING([for RTEMS Version])
|
||||
if test -r "${srcdir}/${RTEMS_TOPdir}/VERSION"; then
|
||||
changequote(,)dnl
|
||||
RTEMS_VERSION=`grep Version ${srcdir}/${RTEMS_TOPdir}/VERSION | \
|
||||
sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'`
|
||||
changequote([,])dnl
|
||||
else
|
||||
AC_MSG_ERROR(Unable to find ${RTEMS_TOPdir}/VERSION)
|
||||
fi
|
||||
if test -z "$RTEMS_VERSION"; then
|
||||
AC_MSG_ERROR(Unable to determine version)
|
||||
fi
|
||||
AC_MSG_RESULT($RTEMS_VERSION)
|
||||
])dnl
|
||||
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
dnl canonicalize target cpu
|
||||
dnl NOTE: Most rtems targets do not fullfil autoconf's
|
||||
dnl target naming conventions "processor-vendor-os"
|
||||
dnl Therefore autoconf's AC_CANONICAL_TARGET will fail for them
|
||||
dnl and we have to fix it for rtems ourselves
|
||||
|
||||
AC_DEFUN(RTEMS_CANONICAL_TARGET_CPU,
|
||||
[
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_MSG_CHECKING(rtems target cpu)
|
||||
changequote(,)dnl
|
||||
case "${target}" in
|
||||
# hpux unix port should go here
|
||||
i[3456]86-go32-rtems*)
|
||||
RTEMS_CPU=i386
|
||||
;;
|
||||
i[3456]86-pc-linux*) # unix "simulator" port
|
||||
RTEMS_CPU=unix
|
||||
;;
|
||||
i[3456]86-*freebsd2*) # unix "simulator" port
|
||||
RTEMS_CPU=unix
|
||||
;;
|
||||
no_cpu-*rtems*)
|
||||
RTEMS_CPU=no_cpu
|
||||
;;
|
||||
sparc-sun-solaris*) # unix "simulator" port
|
||||
RTEMS_CPU=unix
|
||||
;;
|
||||
*)
|
||||
RTEMS_CPU=`echo $target | sed 's%^\([^-]*\)-\(.*\)$%\1%'`
|
||||
;;
|
||||
esac
|
||||
changequote([,])dnl
|
||||
AC_SUBST(RTEMS_CPU)
|
||||
AC_MSG_RESULT($RTEMS_CPU)
|
||||
])
|
||||
|
||||
# Add --enable-maintainer-mode option to configure.
|
||||
# From Jim Meyering
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_MAINTAINER_MODE,
|
||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode is disabled by default
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
[ --enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
USE_MAINTAINER_MODE=$enableval,
|
||||
USE_MAINTAINER_MODE=no)
|
||||
AC_MSG_RESULT($USE_MAINTAINER_MODE)
|
||||
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
|
||||
MAINT=$MAINTAINER_MODE_TRUE
|
||||
AC_SUBST(MAINT)dnl
|
||||
]
|
||||
)
|
||||
|
||||
# Define a conditional.
|
||||
|
||||
AC_DEFUN(AM_CONDITIONAL,
|
||||
[AC_SUBST($1_TRUE)
|
||||
AC_SUBST($1_FALSE)
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi])
|
||||
|
||||
dnl $Id$
|
||||
|
||||
AC_DEFUN(RTEMS_ENABLE_NETWORKING,
|
||||
[
|
||||
AC_ARG_ENABLE(networking,
|
||||
[ --enable-networking enable TCP/IP stack],
|
||||
[case "${enableval}" in
|
||||
yes) RTEMS_HAS_NETWORKING=yes ;;
|
||||
no) RTEMS_HAS_NETWORKING=no ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for enable-networking option) ;;
|
||||
esac],[RTEMS_HAS_NETWORKING=yes])
|
||||
AC_SUBST(RTEMS_HAS_NETWORKING)dnl
|
||||
])
|
||||
|
||||
dnl $Id$
|
||||
|
||||
AC_DEFUN(RTEMS_ENABLE_LIBCDIR,
|
||||
[
|
||||
AC_ARG_ENABLE(libcdir,
|
||||
[ --enable-libcdir=directory set the directory for the C library],
|
||||
[ RTEMS_LIBC_DIR="${enableval}" ; \
|
||||
test -d ${enableval} || AC_MSG_ERROR("$enableval is not a directory" ) ] )
|
||||
AC_SUBST(RTEMS_LIBC_DIR)dnl
|
||||
])
|
||||
|
||||
AC_DEFUN(RTEMS_ENABLE_BARE,
|
||||
[
|
||||
AC_ARG_ENABLE(bare-cpu-cflags,
|
||||
[ --enable-bare-cpu-cflags specify a particular cpu cflag]
|
||||
[ (bare bsp specific)],
|
||||
[case "${enableval}" in
|
||||
no) BARE_CPU_CFLAGS="" ;;
|
||||
*) BARE_CPU_CFLAGS="${enableval}" ;;
|
||||
esac],
|
||||
[BARE_CPU_CFLAGS=""])
|
||||
|
||||
AC_ARG_ENABLE(bare-cpu-model,
|
||||
[ --enable-bare-cpu-model specify a particular cpu model]
|
||||
[ (bare bsp specific)],
|
||||
[case "${enableval}" in
|
||||
no) BARE_CPU_MODEL="" ;;
|
||||
*) BARE_CPU_MODEL="${enableval}" ;;
|
||||
esac],
|
||||
[BARE_CPU_MODEL=""])
|
||||
])
|
||||
|
||||
|
||||
dnl $Id$
|
||||
|
||||
dnl Override the set of BSPs to be built.
|
||||
dnl used by the toplevel configure script
|
||||
dnl RTEMS_ENABLE_RTEMSBSP(rtems_bsp_list)
|
||||
AC_DEFUN(RTEMS_ENABLE_RTEMSBSP,
|
||||
[
|
||||
AC_ARG_ENABLE(rtemsbsp,
|
||||
[ --enable-rtemsbsp=bsp1 bsp2 .. BSPs to include in build],
|
||||
[case "${enableval}" in
|
||||
yes|no) AC_MSG_ERROR([missing argument to --enable-rtemsbsp=\"bsp1 bsp2\"]);;
|
||||
*) $1=$enableval;;
|
||||
esac],[$1=""])
|
||||
])
|
||||
|
||||
dnl Pass a single BSP via an environment variable
|
||||
dnl used by per BSP configure scripts
|
||||
AC_DEFUN(RTEMS_ENV_RTEMSBSP,
|
||||
[dnl
|
||||
AC_MSG_CHECKING([for RTEMS_BSP])
|
||||
AC_CACHE_VAL(rtems_cv_RTEMS_BSP,
|
||||
[dnl
|
||||
test -n "${RTEMS_BSP}" && rtems_cv_RTEMS_BSP="$RTEMS_BSP";
|
||||
])dnl
|
||||
if test -z "$rtems_cv_RTEMS_BSP"; then
|
||||
AC_MSG_ERROR([Missing RTEMS_BSP])
|
||||
fi
|
||||
RTEMS_BSP="$rtems_cv_RTEMS_BSP"
|
||||
AC_MSG_RESULT(${RTEMS_BSP})
|
||||
AC_SUBST(RTEMS_BSP)
|
||||
])
|
||||
|
||||
dnl $Id$
|
||||
|
||||
dnl check if RTEMS support a cpu
|
||||
AC_DEFUN(RTEMS_CHECK_CPU,
|
||||
[dnl
|
||||
AC_REQUIRE([RTEMS_TOP])
|
||||
AC_REQUIRE([RTEMS_CANONICAL_TARGET_CPU])
|
||||
# Is this a supported CPU?
|
||||
AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
|
||||
if test -d "$srcdir/$RTEMS_TOPdir/c/src/exec/score/cpu/$RTEMS_CPU"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_ERROR(no)
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
dnl $Id$
|
||||
|
||||
AC_DEFUN(RTEMS_CANONICAL_HOST,
|
||||
[dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
RTEMS_HOST=$host_os
|
||||
changequote(,)dnl
|
||||
case "${target}" in
|
||||
# hpux unix port should go here
|
||||
i[3456]86-pc-linux*) # unix "simulator" port
|
||||
RTEMS_HOST=Linux
|
||||
;;
|
||||
i[3456]86-*freebsd2*) # unix "simulator" port
|
||||
RTEMS_HOST=FreeBSD
|
||||
;;
|
||||
sparc-sun-solaris*) # unix "simulator" port
|
||||
RTEMS_HOST=Solaris
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
changequote([,])dnl
|
||||
AC_SUBST(RTEMS_HOST)
|
||||
])dnl
|
||||
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
AC_DEFUN(RTEMS_PROJECT_ROOT,
|
||||
[dnl
|
||||
AC_REQUIRE([RTEMS_TOP])
|
||||
if test "$TARGET_SUBDIR" = "." ; then
|
||||
PROJECT_ROOT=$RTEMS_TOPdir/'$(top_builddir)';
|
||||
else
|
||||
PROJECT_ROOT=../$RTEMS_TOPdir/'$(top_builddir)'
|
||||
fi
|
||||
AC_SUBST(PROJECT_ROOT)
|
||||
|
||||
RTEMS_ROOT=$RTEMS_TOPdir/'$(top_builddir)'/c/$RTEMS_BSP
|
||||
AC_SUBST(RTEMS_ROOT)
|
||||
|
||||
INSTALL_CHANGE="\$(KSH) \$(PROJECT_ROOT)/tools/build/install-if-change"
|
||||
AC_SUBST(INSTALL_CHANGE)
|
||||
|
||||
PACKHEX="\$(PROJECT_ROOT)/tools/build/packhex"
|
||||
AC_SUBST(PACKHEX)
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl Check for target gcc
|
||||
dnl
|
||||
dnl 98/05/20 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
dnl Completely reworked
|
||||
|
||||
AC_DEFUN(RTEMS_PROG_CC,
|
||||
[
|
||||
AC_BEFORE([$0], [AC_PROG_CPP])dnl
|
||||
AC_BEFORE([$0], [AC_PROG_CC])dnl
|
||||
AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
|
||||
|
||||
dnl Only accept gcc and cc
|
||||
dnl NOTE: This might be too restrictive for native compilation
|
||||
AC_PATH_PROGS(CC_FOR_TARGET, "$program_prefix"gcc "$program_prefix"cc )
|
||||
test -z "$CC_FOR_TARGET" \
|
||||
&& AC_MSG_ERROR([no acceptable cc found in \$PATH])
|
||||
|
||||
dnl backup
|
||||
rtems_save_CC=$CC
|
||||
rtems_save_CFLAGS=$CFLAGS
|
||||
|
||||
dnl temporarily set CC
|
||||
CC=$CC_FOR_TARGET
|
||||
|
||||
AC_PROG_CC_WORKS
|
||||
AC_PROG_CC_GNU
|
||||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
dnl Check whether -g works, even if CFLAGS is set, in case the package
|
||||
dnl plays around with CFLAGS (such as to build both debugging and
|
||||
dnl normal versions of a library), tasteless as that idea is.
|
||||
ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
AC_PROG_CC_G
|
||||
if test "$ac_test_CFLAGS" = set; then
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
elif test $ac_cv_prog_cc_g = yes; then
|
||||
CFLAGS="-g -O2"
|
||||
else
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
else
|
||||
GCC=
|
||||
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
||||
fi
|
||||
|
||||
rtems_cv_prog_gcc=$ac_cv_prog_gcc
|
||||
rtems_cv_prog_cc_g=$ac_cv_prog_cc_g
|
||||
rtems_cv_prog_cc_works=$ac_cv_prog_cc_works
|
||||
rtems_cv_prog_cc_cross=$ac_cv_prog_cc_cross
|
||||
|
||||
dnl restore initial values
|
||||
CC=$rtems_save_CC
|
||||
CFLAGS=$rtems_save_CFLAGS
|
||||
|
||||
unset ac_cv_prog_gcc
|
||||
unset ac_cv_prog_cc_g
|
||||
unset ac_cv_prog_cc_works
|
||||
unset ac_cv_prog_cc_cross
|
||||
])
|
||||
|
||||
AC_DEFUN(RTEMS_PROG_CC_FOR_TARGET,
|
||||
[
|
||||
dnl check target cc
|
||||
RTEMS_PROG_CC
|
||||
dnl check if the compiler supports --specs
|
||||
RTEMS_GCC_SPECS
|
||||
dnl check if the target compiler may use --pipe
|
||||
RTEMS_GCC_PIPE
|
||||
dnl check if the compiler supports --specs if gcc28 is requested
|
||||
if test "$RTEMS_USE_GCC272" != "yes" ; then
|
||||
if test "$rtems_cv_gcc_specs" = "no"; then
|
||||
AC_MSG_WARN([*** disabling --enable-gcc28])
|
||||
RTEMS_USE_GCC272=yes
|
||||
fi
|
||||
fi
|
||||
test "$rtems_cv_gcc_pipe" = "yes" && CC_FOR_TARGET="$CC_FOR_TARGET --pipe"
|
||||
|
||||
dnl FIXME: HACK for egcs/cygwin mixing '\\' and '/' in gcc -print-*
|
||||
case $host_os in
|
||||
*cygwin*) GCCSED="| sed 's%\\\\%/%g'" ;;
|
||||
*) ;;
|
||||
esac
|
||||
AC_SUBST(GCCSED)
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl Set program_prefix
|
||||
dnl
|
||||
dnl 98/05/20 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
dnl Extracted from configure
|
||||
|
||||
AC_DEFUN(RTEMS_TOOL_PREFIX,
|
||||
[AC_REQUIRE([AC_CANONICAL_TARGET])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
|
||||
changequote(,)dnl
|
||||
if [ "${program_prefix}" = "NONE" ] ; then
|
||||
if [ "${target}" = "${host}" ] ; then
|
||||
program_prefix=
|
||||
else
|
||||
program_prefix=${target}-
|
||||
fi
|
||||
fi
|
||||
changequote([,])dnl
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl Check whether the target compiler accepts -specs
|
||||
dnl
|
||||
dnl 98/02/11 Ralf Corsepius corsepiu@faw.uni-ulm.de
|
||||
dnl
|
||||
|
||||
AC_DEFUN(RTEMS_GCC_SPECS,
|
||||
[AC_REQUIRE([RTEMS_PROG_CC])
|
||||
AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts -specs,rtems_cv_gcc_specs,
|
||||
[
|
||||
rtems_cv_gcc_specs=no
|
||||
if test "$rtems_cv_prog_gcc" = "yes"; then
|
||||
touch confspec
|
||||
echo 'void f(){}' >conftest.c
|
||||
if test -z "`${CC_FOR_TARGET} -specs confspec -c conftest.c 2>&1`";then
|
||||
rtems_cv_gcc_specs=yes
|
||||
fi
|
||||
fi
|
||||
rm -f confspec conftest*
|
||||
])])
|
||||
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl Check whether the target compiler accepts -pipe
|
||||
dnl
|
||||
dnl 98/02/11 Ralf Corsepius corsepiu@faw.uni-ulm.de
|
||||
dnl
|
||||
|
||||
AC_DEFUN(RTEMS_GCC_PIPE,
|
||||
[AC_REQUIRE([RTEMS_PROG_CC])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts --pipe,rtems_cv_gcc_pipe,
|
||||
[
|
||||
rtems_cv_gcc_pipe=no
|
||||
if test "$rtems_cv_prog_gcc" = "yes"; then
|
||||
case "$host_os" in
|
||||
cygwin*)
|
||||
;;
|
||||
*)
|
||||
echo 'void f(){}' >conftest.c
|
||||
if test -z "`${CC_FOR_TARGET} --pipe -c conftest.c 2>&1`";then
|
||||
rtems_cv_gcc_pipe=yes
|
||||
fi
|
||||
rm -f conftest*
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl Set target tools
|
||||
dnl
|
||||
dnl 98/06/23 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
dnl fixing cache/environment variable handling
|
||||
dnl adding checks for cygwin/egcs '\\'-bug
|
||||
dnl adding checks for ranlib/ar -s problem
|
||||
dnl
|
||||
dnl 98/02/12 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
dnl
|
||||
|
||||
AC_DEFUN(RTEMS_GCC_PRINT,
|
||||
[ case $host_os in
|
||||
*cygwin*)
|
||||
dnl FIXME: Hack for cygwin/egcs reporting mixed '\\' and '/'
|
||||
dnl Should be removed once cygwin/egcs reports '/' only
|
||||
$1=`$CC_FOR_TARGET --print-prog-name=$2 | sed -e 's%\\\\%/%g' `
|
||||
;;
|
||||
*)
|
||||
$1=`$CC_FOR_TARGET --print-prog-name=$2`
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
AC_DEFUN(RTEMS_PATH_TOOL,
|
||||
[
|
||||
AC_MSG_CHECKING([target's $2])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,:)
|
||||
AC_MSG_RESULT([$ac_cv_path_$1])
|
||||
|
||||
if test -n "$ac_cv_path_$1"; then
|
||||
dnl retrieve the value from the cache
|
||||
$1=$ac_cv_path_$1
|
||||
else
|
||||
dnl the cache was not set
|
||||
if test -z "[$]$1" ; then
|
||||
if test "$rtems_cv_prog_gcc" = "yes"; then
|
||||
# We are using gcc, ask it about its tool
|
||||
# NOTE: Necessary if gcc was configured to use the target's
|
||||
# native tools or uses prefixes for gnutools (e.g. gas instead of as)
|
||||
RTEMS_GCC_PRINT($1,$2)
|
||||
fi
|
||||
else
|
||||
# The user set an environment variable.
|
||||
# Check whether it is an absolute path, otherwise AC_PATH_PROG
|
||||
# will override the environment variable, which isn't what the user
|
||||
# intends
|
||||
AC_MSG_CHECKING([whether environment variable $1 is an absolute path])
|
||||
case "[$]$1" in
|
||||
/*) # valid
|
||||
AC_MSG_RESULT("yes")
|
||||
;;
|
||||
*) # invalid for AC_PATH_PROG
|
||||
AC_MSG_RESULT("no")
|
||||
AC_MSG_ERROR([***]
|
||||
[Environment variable $1 should either]
|
||||
[be unset (preferred) or contain an absolute path])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_PATH_PROG($1,"$program_prefix"$2,$3)
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN(RTEMS_CANONICALIZE_TOOLS,
|
||||
[AC_REQUIRE([RTEMS_PROG_CC])dnl
|
||||
|
||||
dnl FIXME: What shall be done if these tools are not available?
|
||||
RTEMS_PATH_TOOL(AR_FOR_TARGET,ar,no)
|
||||
RTEMS_PATH_TOOL(AS_FOR_TARGET,as,no)
|
||||
RTEMS_PATH_TOOL(LD_FOR_TARGET,ld,no)
|
||||
RTEMS_PATH_TOOL(NM_FOR_TARGET,nm,no)
|
||||
|
||||
dnl special treatment of ranlib
|
||||
RTEMS_PATH_TOOL(RANLIB_FOR_TARGET,ranlib,no)
|
||||
if test "$RANLIB_FOR_TARGET" = "no"; then
|
||||
# ranlib wasn't found; check if ar -s is available
|
||||
RTEMS_AR_FOR_TARGET_S
|
||||
if test $rtems_cv_AR_FOR_TARGET_S = "yes" ; then
|
||||
dnl override RANLIB_FOR_TARGET's cache
|
||||
ac_cv_path_RANLIB_FOR_TARGET="$AR_FOR_TARGET -s"
|
||||
RANLIB_FOR_TARGET=$ac_cv_path_RANLIB_FOR_TARGET
|
||||
else
|
||||
AC_MSG_ERROR([***]
|
||||
[Can't figure out how to build a library index]
|
||||
[Neither ranlib nor ar -s seem to be available] )
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl NOTE: These may not be available if not using gnutools
|
||||
RTEMS_PATH_TOOL(OBJCOPY_FOR_TARGET,objcopy,no)
|
||||
RTEMS_PATH_TOOL(SIZE_FOR_TARGET,size,no)
|
||||
RTEMS_PATH_TOOL(STRIP_FOR_TARGET,strip,no)
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
AC_DEFUN(RTEMS_AR_FOR_TARGET_S,
|
||||
[
|
||||
AC_CACHE_CHECK(whether $AR_FOR_TARGET -s works,
|
||||
rtems_cv_AR_FOR_TARGET_S,
|
||||
[
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
int foo( int b )
|
||||
{ return b; }
|
||||
EOF
|
||||
if AC_TRY_COMMAND($CC_FOR_TARGET -o conftest.o -c conftest.$ac_ext) \
|
||||
&& AC_TRY_COMMAND($AR_FOR_TARGET -sr conftest.a conftest.o) \
|
||||
&& test -s conftest.a ; \
|
||||
then
|
||||
rtems_cv_AR_FOR_TARGET_S="yes"
|
||||
else
|
||||
rtems_cv_AR_FOR_TARGET_S="no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
dnl $Id$
|
||||
|
||||
dnl Report all available bsps for a target,
|
||||
dnl check if a bsp-subdirectory is present for all bsps found
|
||||
dnl
|
||||
dnl RTEMS_CHECK_BSPS(bsp_list)
|
||||
AC_DEFUN(RTEMS_CHECK_BSPS,
|
||||
[
|
||||
AC_REQUIRE([RTEMS_CHECK_CPU])dnl sets RTEMS_CPU, target
|
||||
AC_REQUIRE([RTEMS_TOP])dnl sets RTEMS_TOPdir
|
||||
AC_MSG_CHECKING([for bsps])
|
||||
case "${target}" in
|
||||
changequote(,)dnl
|
||||
i[3456]86-go32-rtems*)
|
||||
changequote([,])dnl
|
||||
$1="go32 go32_p5"
|
||||
;;
|
||||
*)
|
||||
files=`ls $srcdir/$RTEMS_TOPdir/c/src/lib/libbsp/$RTEMS_CPU`
|
||||
for file in $files; do
|
||||
case $file in
|
||||
shared*);;
|
||||
Makefile*);;
|
||||
READ*);;
|
||||
CVS*);;
|
||||
pxfl*);;
|
||||
go32*);; # so the i386 port can pick up the other Makefiles
|
||||
# Now account for BSPs with build variants
|
||||
gen68360) rtems_bsp="$rtems_bsp gen68360 gen68360_040";;
|
||||
p4000) rtems_bsp="$rtems_bsp p4600 p4650";;
|
||||
mvme162) rtems_bsp="$rtems_bsp mvme162 mvme162lx";;
|
||||
*) $1="[$]$1 $file";;
|
||||
esac;
|
||||
done
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT([[$]$1 .. done])
|
||||
])dnl
|
||||
|
||||
AC_DEFUN(RTEMS_CHECK_CUSTOM_BSP,
|
||||
[dnl
|
||||
AC_MSG_CHECKING([for make/custom/[$]$1.cfg])
|
||||
if test -r "$srcdir/$RTEMS_TOPdir/make/custom/[$]$1.cfg"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_ERROR([no])
|
||||
fi
|
||||
])dnl
|
||||
|
||||
dnl $Id$
|
||||
dnl
|
||||
AC_DEFUN(RTEMS_CHECK_NETWORKING,
|
||||
[dnl
|
||||
AC_REQUIRE([RTEMS_CHECK_CPU])dnl
|
||||
AC_CACHE_CHECK([whether BSP supports networking],
|
||||
rtems_cv_HAS_NETWORKING,
|
||||
[dnl
|
||||
case "$RTEMS_CPU" in
|
||||
unix*)
|
||||
rtems_cv_HAS_NETWORKING="no"
|
||||
;;
|
||||
*)
|
||||
if test "${RTEMS_HAS_NETWORKING}" = "yes"; then
|
||||
rtems_cv_HAS_NETWORKING="yes";
|
||||
else
|
||||
rtems_cv_HAS_NETWORKING="disabled";
|
||||
fi
|
||||
;;
|
||||
esac])
|
||||
if test "$rtems_cv_HAS_NETWORKING" = "yes"; then
|
||||
HAS_NETWORKING="yes";
|
||||
else
|
||||
HAS_NETWORKING="no";
|
||||
fi
|
||||
AC_SUBST(HAS_NETWORKING)dnl
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
dnl RTEMS_BSP_ALIAS(BSP_ALIAS,BSP_RETURNED)
|
||||
dnl convert a bsp alias $1 into its bsp directory $2
|
||||
AC_DEFUN(RTEMS_BSP_ALIAS,
|
||||
[
|
||||
# account for "aliased" bsps which share source code
|
||||
case $1 in
|
||||
mvme162lx) $2=mvme162 ;; # mvme162 board variant
|
||||
gen68360_040) $2=gen68360 ;; # 68360 in companion mode
|
||||
go32_p5) $2=go32 ;; # go32 on Pentium class CPU
|
||||
p4600) $2=p4000 ;; # p4000 board with IDT 4600
|
||||
p4650) $2=p4000 ;; # p4000 board with IDT 4650
|
||||
*) $2=$1;;
|
||||
esac
|
||||
])
|
||||
|
||||
2249
c/src/lib/librpc/configure
vendored
2249
c/src/lib/librpc/configure
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,40 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_PREREQ(2.13)
|
||||
AC_INIT(xdr.c)
|
||||
RTEMS_TOP(../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../..)
|
||||
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_INSTALL
|
||||
# AM_INIT_AUTOMAKE(rtems-c-src-lib-librpc,$RTEMS_VERSION,no)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
RTEMS_ENABLE_NETWORKING
|
||||
RTEMS_ENABLE_LIBCDIR
|
||||
RTEMS_ENABLE_BARE
|
||||
|
||||
RTEMS_ENV_RTEMSBSP
|
||||
|
||||
RTEMS_CHECK_CPU
|
||||
RTEMS_CANONICAL_HOST
|
||||
|
||||
RTEMS_PROJECT_ROOT
|
||||
|
||||
dnl check target cc
|
||||
RTEMS_PROG_CC_FOR_TARGET
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# try to explicitly list a Makefile here
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
)
|
||||
@@ -1,191 +0,0 @@
|
||||
/* @(#)rpc_callmsg.c 2.1 88/07/29 4.0 RPCSRC */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
#if !defined(lint) && defined(SCCSIDS)
|
||||
static char sccsid[] = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rpc_callmsg.c
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h> /* bcopy */
|
||||
#include <rpc/rpc.h>
|
||||
|
||||
bool_t xdr_opaque_auth (register XDR *xdrs, register struct
|
||||
opaque_auth *ap);
|
||||
/*
|
||||
* XDR a call message
|
||||
*/
|
||||
bool_t
|
||||
xdr_callmsg(xdrs, cmsg)
|
||||
register XDR *xdrs;
|
||||
register struct rpc_msg *cmsg;
|
||||
{
|
||||
register long *buf;
|
||||
register struct opaque_auth *oa;
|
||||
|
||||
if (xdrs->x_op == XDR_ENCODE) {
|
||||
if (cmsg->rm_call.cb_cred.oa_length > MAX_AUTH_BYTES) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (cmsg->rm_call.cb_verf.oa_length > MAX_AUTH_BYTES) {
|
||||
return (FALSE);
|
||||
}
|
||||
buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT
|
||||
+ RNDUP(cmsg->rm_call.cb_cred.oa_length)
|
||||
+ 2 * BYTES_PER_XDR_UNIT
|
||||
+ RNDUP(cmsg->rm_call.cb_verf.oa_length));
|
||||
if (buf != NULL) {
|
||||
IXDR_PUT_LONG(buf, cmsg->rm_xid);
|
||||
IXDR_PUT_ENUM(buf, cmsg->rm_direction);
|
||||
if (cmsg->rm_direction != CALL) {
|
||||
return (FALSE);
|
||||
}
|
||||
IXDR_PUT_LONG(buf, cmsg->rm_call.cb_rpcvers);
|
||||
if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION) {
|
||||
return (FALSE);
|
||||
}
|
||||
IXDR_PUT_LONG(buf, cmsg->rm_call.cb_prog);
|
||||
IXDR_PUT_LONG(buf, cmsg->rm_call.cb_vers);
|
||||
IXDR_PUT_LONG(buf, cmsg->rm_call.cb_proc);
|
||||
oa = &cmsg->rm_call.cb_cred;
|
||||
IXDR_PUT_ENUM(buf, oa->oa_flavor);
|
||||
IXDR_PUT_LONG(buf, oa->oa_length);
|
||||
if (oa->oa_length) {
|
||||
bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length);
|
||||
buf += RNDUP(oa->oa_length) / sizeof (long);
|
||||
}
|
||||
oa = &cmsg->rm_call.cb_verf;
|
||||
IXDR_PUT_ENUM(buf, oa->oa_flavor);
|
||||
IXDR_PUT_LONG(buf, oa->oa_length);
|
||||
if (oa->oa_length) {
|
||||
bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length);
|
||||
/* no real need....
|
||||
buf += RNDUP(oa->oa_length) / sizeof (long);
|
||||
*/
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
}
|
||||
if (xdrs->x_op == XDR_DECODE) {
|
||||
buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT);
|
||||
if (buf != NULL) {
|
||||
cmsg->rm_xid = IXDR_GET_LONG(buf);
|
||||
cmsg->rm_direction = IXDR_GET_ENUM(buf, enum msg_type);
|
||||
if (cmsg->rm_direction != CALL) {
|
||||
return (FALSE);
|
||||
}
|
||||
cmsg->rm_call.cb_rpcvers = IXDR_GET_LONG(buf);
|
||||
if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION) {
|
||||
return (FALSE);
|
||||
}
|
||||
cmsg->rm_call.cb_prog = IXDR_GET_LONG(buf);
|
||||
cmsg->rm_call.cb_vers = IXDR_GET_LONG(buf);
|
||||
cmsg->rm_call.cb_proc = IXDR_GET_LONG(buf);
|
||||
oa = &cmsg->rm_call.cb_cred;
|
||||
oa->oa_flavor = IXDR_GET_ENUM(buf, enum_t);
|
||||
oa->oa_length = IXDR_GET_LONG(buf);
|
||||
if (oa->oa_length) {
|
||||
if (oa->oa_length > MAX_AUTH_BYTES) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (oa->oa_base == NULL) {
|
||||
oa->oa_base = (caddr_t)
|
||||
mem_alloc(oa->oa_length);
|
||||
}
|
||||
buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length));
|
||||
if (buf == NULL) {
|
||||
if (xdr_opaque(xdrs, oa->oa_base,
|
||||
oa->oa_length) == FALSE) {
|
||||
return (FALSE);
|
||||
}
|
||||
} else {
|
||||
bcopy((caddr_t)buf, oa->oa_base,
|
||||
oa->oa_length);
|
||||
/* no real need....
|
||||
buf += RNDUP(oa->oa_length) /
|
||||
sizeof (long);
|
||||
*/
|
||||
}
|
||||
}
|
||||
oa = &cmsg->rm_call.cb_verf;
|
||||
buf = XDR_INLINE(xdrs, 2 * BYTES_PER_XDR_UNIT);
|
||||
if (buf == NULL) {
|
||||
if (xdr_enum(xdrs, &oa->oa_flavor) == FALSE ||
|
||||
xdr_u_int(xdrs, &oa->oa_length) == FALSE) {
|
||||
return (FALSE);
|
||||
}
|
||||
} else {
|
||||
oa->oa_flavor = IXDR_GET_ENUM(buf, enum_t);
|
||||
oa->oa_length = IXDR_GET_LONG(buf);
|
||||
}
|
||||
if (oa->oa_length) {
|
||||
if (oa->oa_length > MAX_AUTH_BYTES) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (oa->oa_base == NULL) {
|
||||
oa->oa_base = (caddr_t)
|
||||
mem_alloc(oa->oa_length);
|
||||
}
|
||||
buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length));
|
||||
if (buf == NULL) {
|
||||
if (xdr_opaque(xdrs, oa->oa_base,
|
||||
oa->oa_length) == FALSE) {
|
||||
return (FALSE);
|
||||
}
|
||||
} else {
|
||||
bcopy((caddr_t)buf, oa->oa_base,
|
||||
oa->oa_length);
|
||||
/* no real need...
|
||||
buf += RNDUP(oa->oa_length) /
|
||||
sizeof (long);
|
||||
*/
|
||||
}
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
}
|
||||
if (
|
||||
xdr_u_long(xdrs, &(cmsg->rm_xid)) &&
|
||||
xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) &&
|
||||
(cmsg->rm_direction == CALL) &&
|
||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
|
||||
(cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) &&
|
||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) &&
|
||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)) &&
|
||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_proc)) &&
|
||||
xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)) )
|
||||
return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf)));
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
@@ -1,271 +0,0 @@
|
||||
/* @(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*/
|
||||
|
||||
/*
|
||||
* rpc_prot.c
|
||||
*/
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
|
||||
/* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */
|
||||
|
||||
struct opaque_auth _null_auth;
|
||||
|
||||
/*
|
||||
* XDR an opaque authentication struct
|
||||
* (see auth.h)
|
||||
*/
|
||||
bool_t
|
||||
xdr_opaque_auth(xdrs, ap)
|
||||
register XDR *xdrs;
|
||||
register struct opaque_auth *ap;
|
||||
{
|
||||
|
||||
if (xdr_enum(xdrs, &(ap->oa_flavor)))
|
||||
return (xdr_bytes(xdrs, &ap->oa_base,
|
||||
&ap->oa_length, MAX_AUTH_BYTES));
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR a DES block
|
||||
*/
|
||||
bool_t
|
||||
xdr_des_block(xdrs, blkp)
|
||||
register XDR *xdrs;
|
||||
register des_block *blkp;
|
||||
{
|
||||
return (xdr_opaque(xdrs, (caddr_t)blkp, sizeof(des_block)));
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * XDR RPC MESSAGE * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* XDR the MSG_ACCEPTED part of a reply message union
|
||||
*/
|
||||
bool_t
|
||||
xdr_accepted_reply(xdrs, ar)
|
||||
register XDR *xdrs;
|
||||
register struct accepted_reply *ar;
|
||||
{
|
||||
|
||||
/* personalized union, rather than calling xdr_union */
|
||||
if (! xdr_opaque_auth(xdrs, &(ar->ar_verf)))
|
||||
return (FALSE);
|
||||
if (! xdr_enum(xdrs, (enum_t *)&(ar->ar_stat)))
|
||||
return (FALSE);
|
||||
switch (ar->ar_stat) {
|
||||
|
||||
case SUCCESS:
|
||||
return ((*(ar->ar_results.proc))(xdrs, ar->ar_results.where));
|
||||
|
||||
case PROG_MISMATCH:
|
||||
if (! xdr_u_long(xdrs, &(ar->ar_vers.low)))
|
||||
return (FALSE);
|
||||
return (xdr_u_long(xdrs, &(ar->ar_vers.high)));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (TRUE); /* TRUE => open ended set of problems */
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR the MSG_DENIED part of a reply message union
|
||||
*/
|
||||
bool_t
|
||||
xdr_rejected_reply(xdrs, rr)
|
||||
register XDR *xdrs;
|
||||
register struct rejected_reply *rr;
|
||||
{
|
||||
|
||||
/* personalized union, rather than calling xdr_union */
|
||||
if (! xdr_enum(xdrs, (enum_t *)&(rr->rj_stat)))
|
||||
return (FALSE);
|
||||
switch (rr->rj_stat) {
|
||||
|
||||
case RPC_MISMATCH:
|
||||
if (! xdr_u_long(xdrs, &(rr->rj_vers.low)))
|
||||
return (FALSE);
|
||||
return (xdr_u_long(xdrs, &(rr->rj_vers.high)));
|
||||
|
||||
case AUTH_ERROR:
|
||||
return (xdr_enum(xdrs, (enum_t *)&(rr->rj_why)));
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
static struct xdr_discrim reply_dscrm[3] = {
|
||||
{ (int)MSG_ACCEPTED, xdr_accepted_reply },
|
||||
{ (int)MSG_DENIED, xdr_rejected_reply },
|
||||
{ __dontcare__, NULL_xdrproc_t } };
|
||||
|
||||
/*
|
||||
* XDR a reply message
|
||||
*/
|
||||
bool_t
|
||||
xdr_replymsg(xdrs, rmsg)
|
||||
register XDR *xdrs;
|
||||
register struct rpc_msg *rmsg;
|
||||
{
|
||||
if (
|
||||
xdr_u_long(xdrs, &(rmsg->rm_xid)) &&
|
||||
xdr_enum(xdrs, (enum_t *)&(rmsg->rm_direction)) &&
|
||||
(rmsg->rm_direction == REPLY) )
|
||||
return (xdr_union(xdrs, (enum_t *)&(rmsg->rm_reply.rp_stat),
|
||||
(caddr_t)&(rmsg->rm_reply.ru), reply_dscrm, NULL_xdrproc_t));
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Serializes the "static part" of a call message header.
|
||||
* The fields include: rm_xid, rm_direction, rpcvers, prog, and vers.
|
||||
* The rm_xid is not really static, but the user can easily munge on the fly.
|
||||
*/
|
||||
bool_t
|
||||
xdr_callhdr(xdrs, cmsg)
|
||||
register XDR *xdrs;
|
||||
register struct rpc_msg *cmsg;
|
||||
{
|
||||
|
||||
cmsg->rm_direction = CALL;
|
||||
cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION;
|
||||
if (
|
||||
(xdrs->x_op == XDR_ENCODE) &&
|
||||
xdr_u_long(xdrs, &(cmsg->rm_xid)) &&
|
||||
xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) &&
|
||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
|
||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) )
|
||||
return (xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)));
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* ************************** Client utility routine ************* */
|
||||
|
||||
static void
|
||||
accepted(acpt_stat, error)
|
||||
register enum accept_stat acpt_stat;
|
||||
register struct rpc_err *error;
|
||||
{
|
||||
|
||||
switch (acpt_stat) {
|
||||
|
||||
case PROG_UNAVAIL:
|
||||
error->re_status = RPC_PROGUNAVAIL;
|
||||
return;
|
||||
|
||||
case PROG_MISMATCH:
|
||||
error->re_status = RPC_PROGVERSMISMATCH;
|
||||
return;
|
||||
|
||||
case PROC_UNAVAIL:
|
||||
error->re_status = RPC_PROCUNAVAIL;
|
||||
return;
|
||||
|
||||
case GARBAGE_ARGS:
|
||||
error->re_status = RPC_CANTDECODEARGS;
|
||||
return;
|
||||
|
||||
case SYSTEM_ERR:
|
||||
error->re_status = RPC_SYSTEMERROR;
|
||||
return;
|
||||
|
||||
case SUCCESS:
|
||||
error->re_status = RPC_SUCCESS;
|
||||
return;
|
||||
}
|
||||
/* something's wrong, but we don't know what ... */
|
||||
error->re_status = RPC_FAILED;
|
||||
error->re_lb.s1 = (long)MSG_ACCEPTED;
|
||||
error->re_lb.s2 = (long)acpt_stat;
|
||||
}
|
||||
|
||||
static void
|
||||
rejected(rjct_stat, error)
|
||||
register enum reject_stat rjct_stat;
|
||||
register struct rpc_err *error;
|
||||
{
|
||||
|
||||
switch (rjct_stat) {
|
||||
|
||||
case RPC_VERSMISMATCH:
|
||||
error->re_status = RPC_VERSMISMATCH;
|
||||
return;
|
||||
|
||||
case AUTH_ERROR:
|
||||
error->re_status = RPC_AUTHERROR;
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* something's wrong, but we don't know what ... */
|
||||
error->re_status = RPC_FAILED;
|
||||
error->re_lb.s1 = (long)MSG_DENIED;
|
||||
error->re_lb.s2 = (long)rjct_stat;
|
||||
}
|
||||
|
||||
/*
|
||||
* given a reply message, fills in the error
|
||||
*/
|
||||
void
|
||||
_seterr_reply(msg, error)
|
||||
register struct rpc_msg *msg;
|
||||
register struct rpc_err *error;
|
||||
{
|
||||
|
||||
/* optimized for normal, SUCCESSful case */
|
||||
switch (msg->rm_reply.rp_stat) {
|
||||
|
||||
case MSG_ACCEPTED:
|
||||
if (msg->acpted_rply.ar_stat == SUCCESS) {
|
||||
error->re_status = RPC_SUCCESS;
|
||||
return;
|
||||
};
|
||||
accepted(msg->acpted_rply.ar_stat, error);
|
||||
break;
|
||||
|
||||
case MSG_DENIED:
|
||||
rejected(msg->rjcted_rply.rj_stat, error);
|
||||
break;
|
||||
|
||||
default:
|
||||
error->re_status = RPC_FAILED;
|
||||
error->re_lb.s1 = (long)(msg->rm_reply.rp_stat);
|
||||
break;
|
||||
}
|
||||
switch (error->re_status) {
|
||||
|
||||
case RPC_VERSMISMATCH:
|
||||
error->re_vers.low = msg->rjcted_rply.rj_vers.low;
|
||||
error->re_vers.high = msg->rjcted_rply.rj_vers.high;
|
||||
break;
|
||||
|
||||
case RPC_AUTHERROR:
|
||||
error->re_why = msg->rjcted_rply.rj_why;
|
||||
break;
|
||||
|
||||
case RPC_PROGVERSMISMATCH:
|
||||
error->re_vers.low = msg->acpted_rply.ar_vers.low;
|
||||
error->re_vers.high = msg->acpted_rply.ar_vers.high;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,259 +0,0 @@
|
||||
/* @(#)svc.c 2.4 88/08/11 4.0 RPCSRC; from 1.44 88/02/08 SMI */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
#if !defined(lint) && defined(SCCSIDS)
|
||||
static char sccsid[] = "@(#)svc.c 1.41 87/10/13 Copyr 1984 Sun Micro";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* svc.c, Server-side remote procedure call interface.
|
||||
*
|
||||
* There are two sets of procedures here. The xprt routines are
|
||||
* for handling transport handles. The svc routines handle the
|
||||
* list of service routines.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define RQCRED_SIZE 400 /* this size is excessive */
|
||||
|
||||
/* ******************* REPLY GENERATION ROUTINES ************ */
|
||||
|
||||
/*
|
||||
* Send a reply to an rpc request
|
||||
*/
|
||||
bool_t
|
||||
svc_sendreply(xprt, xdr_results, xdr_location)
|
||||
register SVCXPRT *xprt;
|
||||
xdrproc_t xdr_results;
|
||||
caddr_t xdr_location;
|
||||
{
|
||||
struct rpc_msg rply;
|
||||
|
||||
rply.rm_direction = REPLY;
|
||||
rply.rm_reply.rp_stat = MSG_ACCEPTED;
|
||||
rply.acpted_rply.ar_verf = xprt->xp_verf;
|
||||
rply.acpted_rply.ar_stat = SUCCESS;
|
||||
rply.acpted_rply.ar_results.where = xdr_location;
|
||||
rply.acpted_rply.ar_results.proc = xdr_results;
|
||||
return (SVC_REPLY(xprt, &rply));
|
||||
}
|
||||
|
||||
/*
|
||||
* No procedure error reply
|
||||
*/
|
||||
void
|
||||
svcerr_noproc(xprt)
|
||||
register SVCXPRT *xprt;
|
||||
{
|
||||
struct rpc_msg rply;
|
||||
|
||||
rply.rm_direction = REPLY;
|
||||
rply.rm_reply.rp_stat = MSG_ACCEPTED;
|
||||
rply.acpted_rply.ar_verf = xprt->xp_verf;
|
||||
rply.acpted_rply.ar_stat = PROC_UNAVAIL;
|
||||
SVC_REPLY(xprt, &rply);
|
||||
}
|
||||
|
||||
/*
|
||||
* Can't decode args error reply
|
||||
*/
|
||||
void
|
||||
svcerr_decode(xprt)
|
||||
register SVCXPRT *xprt;
|
||||
{
|
||||
struct rpc_msg rply;
|
||||
|
||||
rply.rm_direction = REPLY;
|
||||
rply.rm_reply.rp_stat = MSG_ACCEPTED;
|
||||
rply.acpted_rply.ar_verf = xprt->xp_verf;
|
||||
rply.acpted_rply.ar_stat = GARBAGE_ARGS;
|
||||
SVC_REPLY(xprt, &rply);
|
||||
}
|
||||
|
||||
/*
|
||||
* Some system error
|
||||
*/
|
||||
void
|
||||
svcerr_systemerr(xprt)
|
||||
register SVCXPRT *xprt;
|
||||
{
|
||||
struct rpc_msg rply;
|
||||
|
||||
rply.rm_direction = REPLY;
|
||||
rply.rm_reply.rp_stat = MSG_ACCEPTED;
|
||||
rply.acpted_rply.ar_verf = xprt->xp_verf;
|
||||
rply.acpted_rply.ar_stat = SYSTEM_ERR;
|
||||
SVC_REPLY(xprt, &rply);
|
||||
}
|
||||
|
||||
/*
|
||||
* Authentication error reply
|
||||
*/
|
||||
void
|
||||
svcerr_auth(xprt, why)
|
||||
SVCXPRT *xprt;
|
||||
enum auth_stat why;
|
||||
{
|
||||
struct rpc_msg rply;
|
||||
|
||||
rply.rm_direction = REPLY;
|
||||
rply.rm_reply.rp_stat = MSG_DENIED;
|
||||
rply.rjcted_rply.rj_stat = AUTH_ERROR;
|
||||
rply.rjcted_rply.rj_why = why;
|
||||
SVC_REPLY(xprt, &rply);
|
||||
}
|
||||
|
||||
/*
|
||||
* Auth too weak error reply
|
||||
*/
|
||||
void
|
||||
svcerr_weakauth(xprt)
|
||||
SVCXPRT *xprt;
|
||||
{
|
||||
|
||||
svcerr_auth(xprt, AUTH_TOOWEAK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Program unavailable error reply
|
||||
*/
|
||||
void
|
||||
svcerr_noprog(xprt)
|
||||
register SVCXPRT *xprt;
|
||||
{
|
||||
struct rpc_msg rply;
|
||||
|
||||
rply.rm_direction = REPLY;
|
||||
rply.rm_reply.rp_stat = MSG_ACCEPTED;
|
||||
rply.acpted_rply.ar_verf = xprt->xp_verf;
|
||||
rply.acpted_rply.ar_stat = PROG_UNAVAIL;
|
||||
SVC_REPLY(xprt, &rply);
|
||||
}
|
||||
|
||||
/*
|
||||
* Program version mismatch error reply
|
||||
*/
|
||||
void
|
||||
svcerr_progvers(xprt, low_vers, high_vers)
|
||||
register SVCXPRT *xprt;
|
||||
u_long low_vers;
|
||||
u_long high_vers;
|
||||
{
|
||||
struct rpc_msg rply;
|
||||
|
||||
rply.rm_direction = REPLY;
|
||||
rply.rm_reply.rp_stat = MSG_ACCEPTED;
|
||||
rply.acpted_rply.ar_verf = xprt->xp_verf;
|
||||
rply.acpted_rply.ar_stat = PROG_MISMATCH;
|
||||
rply.acpted_rply.ar_vers.low = low_vers;
|
||||
rply.acpted_rply.ar_vers.high = high_vers;
|
||||
SVC_REPLY(xprt, &rply);
|
||||
}
|
||||
|
||||
void
|
||||
svc_processrequest(xprt, prog, vers, dispatch)
|
||||
SVCXPRT *xprt;
|
||||
u_long prog;
|
||||
u_long vers;
|
||||
void (*dispatch)();
|
||||
{
|
||||
struct rpc_msg msg;
|
||||
int prog_found = FALSE;
|
||||
u_long low_vers = 0; /* dummy init */
|
||||
u_long high_vers = 0; /* dummy init */
|
||||
struct svc_req r;
|
||||
/*static char cred_area[2*MAX_AUTH_BYTES + RQCRED_SIZE];*/
|
||||
char *cred_area;
|
||||
|
||||
cred_area = (char *)malloc(2*MAX_AUTH_BYTES + RQCRED_SIZE);
|
||||
msg.rm_call.cb_cred.oa_base = cred_area;
|
||||
msg.rm_call.cb_verf.oa_base = &(cred_area[MAX_AUTH_BYTES]);
|
||||
r.rq_clntcred = &(cred_area[2*MAX_AUTH_BYTES]);
|
||||
|
||||
if (SVC_RECV(xprt, &msg)) {
|
||||
|
||||
/* now find the exported program and call it */
|
||||
/* register struct svc_callout *s; */
|
||||
enum auth_stat why;
|
||||
|
||||
r.rq_xprt = xprt;
|
||||
r.rq_prog = msg.rm_call.cb_prog;
|
||||
r.rq_vers = msg.rm_call.cb_vers;
|
||||
r.rq_proc = msg.rm_call.cb_proc;
|
||||
r.rq_cred = msg.rm_call.cb_cred;
|
||||
|
||||
/* first authenticate the message */
|
||||
if ((why= _authenticate(&r, &msg)) != AUTH_OK) {
|
||||
svcerr_auth(xprt, why);
|
||||
free(cred_area);
|
||||
return;
|
||||
}
|
||||
|
||||
/* now match message with a registered service*/
|
||||
prog_found = FALSE;
|
||||
low_vers = 0 - 1;
|
||||
high_vers = 0;
|
||||
if (prog == r.rq_prog) {
|
||||
if (vers == r.rq_vers) {
|
||||
(*dispatch)(&r, xprt);
|
||||
free(cred_area);
|
||||
return;
|
||||
} /* found correct version */
|
||||
prog_found = TRUE;
|
||||
if (vers < low_vers)
|
||||
low_vers = vers;
|
||||
if (vers > high_vers)
|
||||
high_vers = vers;
|
||||
} /* found correct program */
|
||||
}
|
||||
/*
|
||||
* if we got here, the program or version
|
||||
* is not served ...
|
||||
*/
|
||||
if (prog_found) {
|
||||
svcerr_progvers(xprt,
|
||||
low_vers, high_vers);
|
||||
} else {
|
||||
svcerr_noprog(xprt);
|
||||
}
|
||||
|
||||
free(cred_area);
|
||||
|
||||
}
|
||||
|
||||
/* stubs for solaris rpcgen */
|
||||
/*int _rpcsvccount;
|
||||
int _rpcsvcstate;
|
||||
int _SERVED;
|
||||
*/
|
||||
@@ -1,124 +0,0 @@
|
||||
|
||||
#if !defined(lint) && defined(SCCSIDS)
|
||||
static char sccsid[] = "@(#)svc_auth.c 2.1 88/08/07 4.0 RPCSRC; from 1.19 87/08/11 Copyr 1984 Sun Micro";
|
||||
#endif
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
|
||||
/*
|
||||
* svc_auth_nodes.c, Server-side rpc authenticator interface,
|
||||
* *WITHOUT* DES authentication.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
|
||||
/*
|
||||
* svcauthsw is the bdevsw of server side authentication.
|
||||
*
|
||||
* Server side authenticators are called from authenticate by
|
||||
* using the client auth struct flavor field to index into svcauthsw.
|
||||
* The server auth flavors must implement a routine that looks
|
||||
* like:
|
||||
*
|
||||
* enum auth_stat
|
||||
* flavorx_auth(rqst, msg)
|
||||
* register struct svc_req *rqst;
|
||||
* register struct rpc_msg *msg;
|
||||
*
|
||||
*/
|
||||
|
||||
enum auth_stat _svcauth_null(); /* no authentication */
|
||||
enum auth_stat _svcauth_unix(); /* unix style (uid, gids) */
|
||||
enum auth_stat _svcauth_short(); /* short hand unix style */
|
||||
|
||||
static struct {
|
||||
enum auth_stat (*authenticator)();
|
||||
} svcauthsw[] = {
|
||||
{
|
||||
_svcauth_null, /* AUTH_NULL */
|
||||
#ifdef MR
|
||||
_svcauth_unix, /* AUTH_UNIX */
|
||||
_svcauth_short /* AUTH_SHORT */
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MR
|
||||
#define AUTH_MAX 2 /* HIGHEST AUTH NUMBER */
|
||||
#else
|
||||
#define AUTH_MAX 0 /* HIGHEST AUTH NUMBER */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The call rpc message, msg has been obtained from the wire. The msg contains
|
||||
* the raw form of credentials and verifiers. authenticate returns AUTH_OK
|
||||
* if the msg is successfully authenticated. If AUTH_OK then the routine also
|
||||
* does the following things:
|
||||
* set rqst->rq_xprt->verf to the appropriate response verifier;
|
||||
* sets rqst->rq_client_cred to the "cooked" form of the credentials.
|
||||
*
|
||||
* NB: rqst->rq_cxprt->verf must be pre-alloctaed;
|
||||
* its length is set appropriately.
|
||||
*
|
||||
* The caller still owns and is responsible for msg->u.cmb.cred and
|
||||
* msg->u.cmb.verf. The authentication system retains ownership of
|
||||
* rqst->rq_client_cred, the cooked credentials.
|
||||
*
|
||||
* There is an assumption that any flavour less than AUTH_NULL is
|
||||
* invalid.
|
||||
*/
|
||||
enum auth_stat
|
||||
_authenticate(rqst, msg)
|
||||
register struct svc_req *rqst;
|
||||
struct rpc_msg *msg;
|
||||
{
|
||||
register int cred_flavor;
|
||||
|
||||
rqst->rq_cred = msg->rm_call.cb_cred;
|
||||
rqst->rq_xprt->xp_verf.oa_flavor = _null_auth.oa_flavor;
|
||||
rqst->rq_xprt->xp_verf.oa_length = 0;
|
||||
cred_flavor = rqst->rq_cred.oa_flavor;
|
||||
if ((cred_flavor <= AUTH_MAX) && (cred_flavor >= AUTH_NULL)) {
|
||||
return ((*(svcauthsw[cred_flavor].authenticator))(rqst, msg));
|
||||
}
|
||||
|
||||
return (AUTH_REJECTEDCRED);
|
||||
}
|
||||
|
||||
enum auth_stat
|
||||
_svcauth_null(/*rqst, msg*/)
|
||||
/*struct svc_req *rqst;
|
||||
struct rpc_msg *msg;*/
|
||||
{
|
||||
|
||||
return (AUTH_OK);
|
||||
}
|
||||
@@ -1,476 +0,0 @@
|
||||
/* @(#)svc_udp.c 2.2 88/07/29 4.0 RPCSRC */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
#if !defined(lint) && defined(SCCSIDS)
|
||||
static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* svc_udp.c,
|
||||
* Server side for UDP/IP based RPC. (Does some caching in the hopes of
|
||||
* achieving execute-at-most-once semantics.)
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Adapted for rgdb specifi purposes.
|
||||
* Modifications are under #ifndef NO_RGDB.
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* printf */
|
||||
#include <stdlib.h> /* free */
|
||||
#include <string.h> /* bzero, bcmp */
|
||||
#include <rpc/rpc.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define rpc_buffer(xprt) ((xprt)->xp_p1)
|
||||
#define MAX(a, b) ((a > b) ? a : b)
|
||||
|
||||
static bool_t svcudp_recv();
|
||||
static bool_t svcudp_reply();
|
||||
static enum xprt_stat svcudp_stat();
|
||||
static bool_t svcudp_getargs();
|
||||
static bool_t svcudp_freeargs();
|
||||
static void svcudp_destroy();
|
||||
static int cache_get();
|
||||
static void cache_set();
|
||||
|
||||
static struct xp_ops svcudp_op = {
|
||||
svcudp_recv,
|
||||
svcudp_stat,
|
||||
svcudp_getargs,
|
||||
svcudp_reply,
|
||||
svcudp_freeargs,
|
||||
svcudp_destroy
|
||||
};
|
||||
|
||||
extern int errno;
|
||||
|
||||
/*
|
||||
* kept in xprt->xp_p2
|
||||
*/
|
||||
struct svcudp_data {
|
||||
u_int su_iosz; /* byte size of send.recv buffer */
|
||||
u_long su_xid; /* transaction id */
|
||||
XDR su_xdrs; /* XDR handle */
|
||||
char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */
|
||||
char * su_cache; /* cached data, NULL if no cache */
|
||||
};
|
||||
#define su_data(xprt) ((struct svcudp_data *)(xprt->xp_p2))
|
||||
|
||||
/*
|
||||
* Usage:
|
||||
* xprt = svcudp_create(sock);
|
||||
*
|
||||
* If sock<0 then a socket is created, else sock is used.
|
||||
* If the socket, sock is not bound to a port then svcudp_create
|
||||
* binds it to an arbitrary port. In any (successful) case,
|
||||
* xprt->xp_sock is the registered socket number and xprt->xp_port is the
|
||||
* associated port number.
|
||||
* Once *xprt is initialized, it is registered as a transporter;
|
||||
* see (svc.h, xprt_register).
|
||||
* The routines returns NULL if a problem occurred.
|
||||
*/
|
||||
SVCXPRT *
|
||||
svcudp_bufcreate(sock, sendsz, recvsz)
|
||||
register int sock;
|
||||
u_int sendsz, recvsz;
|
||||
{
|
||||
register SVCXPRT *xprt;
|
||||
register struct svcudp_data *su;
|
||||
struct sockaddr_in addr;
|
||||
int len = sizeof(struct sockaddr_in);
|
||||
|
||||
if (sock == RPC_ANYSOCK) {
|
||||
(void)printf
|
||||
("svcudp_create: socket should be created and bound\n");
|
||||
return ((SVCXPRT *) NULL);
|
||||
}
|
||||
|
||||
if (getsockname(sock, (struct sockaddr *)&addr, &len) != 0) {
|
||||
(void)printf("svcudp_create - cannot getsockname");
|
||||
return ((SVCXPRT *)NULL);
|
||||
}
|
||||
|
||||
xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT));
|
||||
|
||||
if (xprt == NULL) {
|
||||
(void)printf("svcudp_create: out of memory\n");
|
||||
return (NULL);
|
||||
}
|
||||
su = (struct svcudp_data *)mem_alloc(sizeof(*su));
|
||||
if (su == NULL) {
|
||||
(void)printf("svcudp_create: out of memory\n");
|
||||
return (NULL);
|
||||
}
|
||||
su->su_iosz = ((MAX(sendsz, recvsz) + 3) / 4) * 4;
|
||||
if ((rpc_buffer(xprt) = (caddr_t) mem_alloc(su->su_iosz)) == NULL) {
|
||||
(void)printf("svcudp_create: out of memory\n");
|
||||
return (NULL);
|
||||
}
|
||||
xdrmem_create(
|
||||
&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz, XDR_DECODE);
|
||||
su->su_cache = NULL;
|
||||
xprt->xp_p2 = (caddr_t)su;
|
||||
xprt->xp_verf.oa_base = su->su_verfbody;
|
||||
xprt->xp_ops = &svcudp_op;
|
||||
xprt->xp_port = ntohs(addr.sin_port);
|
||||
xprt->xp_sock = sock;
|
||||
return (xprt);
|
||||
}
|
||||
|
||||
SVCXPRT *
|
||||
svcudp_create(sock)
|
||||
int sock;
|
||||
{
|
||||
|
||||
/* return(svcudp_bufcreate(sock, UDPMSGSIZE, UDPMSGSIZE));*/
|
||||
return(svcudp_bufcreate(sock, 1500, 1500));
|
||||
}
|
||||
|
||||
static enum xprt_stat
|
||||
svcudp_stat(xprt)
|
||||
SVCXPRT *xprt;
|
||||
{
|
||||
|
||||
return (XPRT_IDLE);
|
||||
}
|
||||
|
||||
static bool_t
|
||||
svcudp_recv(xprt, msg)
|
||||
register SVCXPRT *xprt;
|
||||
struct rpc_msg *msg;
|
||||
{
|
||||
register struct svcudp_data *su = su_data(xprt);
|
||||
register XDR *xdrs = &(su->su_xdrs);
|
||||
register int rlen;
|
||||
char *reply;
|
||||
u_long replylen;
|
||||
|
||||
again:
|
||||
xprt->xp_addrlen = sizeof(struct sockaddr_in);
|
||||
rlen = recvfrom(xprt->xp_sock, rpc_buffer(xprt), (int) su->su_iosz,
|
||||
0, (struct sockaddr *)&(xprt->xp_raddr), &(xprt->xp_addrlen));
|
||||
if (rlen == -1 /* && errno == EINTR */)
|
||||
goto again;
|
||||
if (rlen < 4*sizeof(u_long))
|
||||
return (FALSE);
|
||||
xdrs->x_op = XDR_DECODE;
|
||||
XDR_SETPOS(xdrs, 0);
|
||||
if (! xdr_callmsg(xdrs, msg))
|
||||
return (FALSE);
|
||||
su->su_xid = msg->rm_xid;
|
||||
if (su->su_cache != NULL) {
|
||||
if (cache_get(xprt, msg, &reply, &replylen)) {
|
||||
(void) sendto(xprt->xp_sock, reply, (int) replylen, 0,
|
||||
(struct sockaddr *) &xprt->xp_raddr, xprt->xp_addrlen);
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static bool_t
|
||||
svcudp_reply(xprt, msg)
|
||||
register SVCXPRT *xprt;
|
||||
struct rpc_msg *msg;
|
||||
{
|
||||
register struct svcudp_data *su = su_data(xprt);
|
||||
register XDR *xdrs = &(su->su_xdrs);
|
||||
register int slen;
|
||||
register bool_t stat = FALSE;
|
||||
|
||||
xdrs->x_op = XDR_ENCODE;
|
||||
XDR_SETPOS(xdrs, 0);
|
||||
msg->rm_xid = su->su_xid;
|
||||
if (xdr_replymsg(xdrs, msg)) {
|
||||
slen = (int)XDR_GETPOS(xdrs);
|
||||
if (sendto(xprt->xp_sock, rpc_buffer(xprt), slen, 0,
|
||||
(struct sockaddr *)&(xprt->xp_raddr), xprt->xp_addrlen)
|
||||
== slen) {
|
||||
stat = TRUE;
|
||||
if (su->su_cache && slen >= 0) {
|
||||
cache_set(xprt, (u_long) slen);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (stat);
|
||||
}
|
||||
|
||||
static bool_t
|
||||
svcudp_getargs(xprt, xdr_args, args_ptr)
|
||||
SVCXPRT *xprt;
|
||||
xdrproc_t xdr_args;
|
||||
caddr_t args_ptr;
|
||||
{
|
||||
|
||||
return ((*xdr_args)(&(su_data(xprt)->su_xdrs), args_ptr));
|
||||
}
|
||||
|
||||
static bool_t
|
||||
svcudp_freeargs(xprt, xdr_args, args_ptr)
|
||||
SVCXPRT *xprt;
|
||||
xdrproc_t xdr_args;
|
||||
caddr_t args_ptr;
|
||||
{
|
||||
register XDR *xdrs = &(su_data(xprt)->su_xdrs);
|
||||
|
||||
xdrs->x_op = XDR_FREE;
|
||||
return ((*xdr_args)(xdrs, args_ptr));
|
||||
}
|
||||
|
||||
static void
|
||||
svcudp_destroy(xprt)
|
||||
register SVCXPRT *xprt;
|
||||
{
|
||||
register struct svcudp_data *su = su_data(xprt);
|
||||
/*
|
||||
xprt_unregister(xprt);
|
||||
(void)close(xprt->xp_sock);
|
||||
*/
|
||||
XDR_DESTROY(&(su->su_xdrs));
|
||||
mem_free(rpc_buffer(xprt), su->su_iosz);
|
||||
mem_free((caddr_t)su, sizeof(struct svcudp_data));
|
||||
mem_free((caddr_t)xprt, sizeof(SVCXPRT));
|
||||
}
|
||||
|
||||
|
||||
/***********this could be a separate file*********************/
|
||||
|
||||
/*
|
||||
* Fifo cache for udp server
|
||||
* Copies pointers to reply buffers into fifo cache
|
||||
* Buffers are sent again if retransmissions are detected.
|
||||
*/
|
||||
|
||||
#define SPARSENESS 4 /* 75% sparse */
|
||||
|
||||
#define CACHE_PERROR(msg) \
|
||||
(void) printf("%s\n", msg)
|
||||
|
||||
#define ALLOC(type, size) \
|
||||
(type *) mem_alloc((unsigned) (sizeof(type) * (size)))
|
||||
|
||||
#define BZERO(addr, type, size) \
|
||||
bzero((char *) addr, sizeof(type) * (int) (size))
|
||||
|
||||
/*
|
||||
* An entry in the cache
|
||||
*/
|
||||
typedef struct cache_node *cache_ptr;
|
||||
struct cache_node {
|
||||
/*
|
||||
* Index into cache is xid, proc, vers, prog and address
|
||||
*/
|
||||
u_long cache_xid;
|
||||
u_long cache_proc;
|
||||
u_long cache_vers;
|
||||
u_long cache_prog;
|
||||
struct sockaddr_in cache_addr;
|
||||
/*
|
||||
* The cached reply and length
|
||||
*/
|
||||
char * cache_reply;
|
||||
u_long cache_replylen;
|
||||
/*
|
||||
* Next node on the list, if there is a collision
|
||||
*/
|
||||
cache_ptr cache_next;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The entire cache
|
||||
*/
|
||||
struct udp_cache {
|
||||
u_long uc_size; /* size of cache */
|
||||
cache_ptr *uc_entries; /* hash table of entries in cache */
|
||||
cache_ptr *uc_fifo; /* fifo list of entries in cache */
|
||||
u_long uc_nextvictim; /* points to next victim in fifo list */
|
||||
u_long uc_prog; /* saved program number */
|
||||
u_long uc_vers; /* saved version number */
|
||||
u_long uc_proc; /* saved procedure number */
|
||||
struct sockaddr_in uc_addr; /* saved caller's address */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* the hashing function
|
||||
*/
|
||||
#define CACHE_LOC(transp, xid) \
|
||||
(xid % (SPARSENESS*((struct udp_cache *) su_data(transp)->su_cache)->uc_size))
|
||||
|
||||
|
||||
/*
|
||||
* Enable use of the cache.
|
||||
* Note: there is no disable.
|
||||
*/
|
||||
int
|
||||
svcudp_enablecache(transp, size)
|
||||
SVCXPRT *transp;
|
||||
u_long size;
|
||||
{
|
||||
struct svcudp_data *su = su_data(transp);
|
||||
struct udp_cache *uc;
|
||||
|
||||
if (su->su_cache != NULL) {
|
||||
CACHE_PERROR("enablecache: cache already enabled");
|
||||
return(0);
|
||||
}
|
||||
uc = ALLOC(struct udp_cache, 1);
|
||||
if (uc == NULL) {
|
||||
CACHE_PERROR("enablecache: could not allocate cache");
|
||||
return(0);
|
||||
}
|
||||
uc->uc_size = size;
|
||||
uc->uc_nextvictim = 0;
|
||||
uc->uc_entries = ALLOC(cache_ptr, size * SPARSENESS);
|
||||
if (uc->uc_entries == NULL) {
|
||||
CACHE_PERROR("enablecache: could not allocate cache data");
|
||||
return(0);
|
||||
}
|
||||
BZERO(uc->uc_entries, cache_ptr, size * SPARSENESS);
|
||||
uc->uc_fifo = ALLOC(cache_ptr, size);
|
||||
if (uc->uc_fifo == NULL) {
|
||||
CACHE_PERROR("enablecache: could not allocate cache fifo");
|
||||
return(0);
|
||||
}
|
||||
BZERO(uc->uc_fifo, cache_ptr, size);
|
||||
su->su_cache = (char *) uc;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set an entry in the cache
|
||||
*/
|
||||
static void
|
||||
cache_set(xprt, replylen)
|
||||
SVCXPRT *xprt;
|
||||
u_long replylen;
|
||||
{
|
||||
register cache_ptr victim;
|
||||
register cache_ptr *vicp;
|
||||
register struct svcudp_data *su = su_data(xprt);
|
||||
struct udp_cache *uc = (struct udp_cache *) su->su_cache;
|
||||
u_int loc;
|
||||
char *newbuf;
|
||||
|
||||
/*
|
||||
* Find space for the new entry, either by
|
||||
* reusing an old entry, or by mallocing a new one
|
||||
*/
|
||||
victim = uc->uc_fifo[uc->uc_nextvictim];
|
||||
if (victim != NULL) {
|
||||
loc = CACHE_LOC(xprt, victim->cache_xid);
|
||||
for (vicp = &uc->uc_entries[loc];
|
||||
*vicp != NULL && *vicp != victim;
|
||||
vicp = &(*vicp)->cache_next)
|
||||
;
|
||||
if (*vicp == NULL) {
|
||||
CACHE_PERROR("cache_set: victim not found");
|
||||
return;
|
||||
}
|
||||
*vicp = victim->cache_next; /* remote from cache */
|
||||
newbuf = victim->cache_reply;
|
||||
} else {
|
||||
victim = ALLOC(struct cache_node, 1);
|
||||
if (victim == NULL) {
|
||||
CACHE_PERROR("cache_set: victim alloc failed");
|
||||
return;
|
||||
}
|
||||
newbuf = (char*) mem_alloc(su->su_iosz);
|
||||
if (newbuf == NULL) {
|
||||
CACHE_PERROR("cache_set: could not allocate new rpc_buffer");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Store it away
|
||||
*/
|
||||
victim->cache_replylen = replylen;
|
||||
victim->cache_reply = rpc_buffer(xprt);
|
||||
rpc_buffer(xprt) = newbuf;
|
||||
xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz, XDR_ENCODE);
|
||||
victim->cache_xid = su->su_xid;
|
||||
victim->cache_proc = uc->uc_proc;
|
||||
victim->cache_vers = uc->uc_vers;
|
||||
victim->cache_prog = uc->uc_prog;
|
||||
victim->cache_addr = uc->uc_addr;
|
||||
loc = CACHE_LOC(xprt, victim->cache_xid);
|
||||
victim->cache_next = uc->uc_entries[loc];
|
||||
uc->uc_entries[loc] = victim;
|
||||
uc->uc_fifo[uc->uc_nextvictim++] = victim;
|
||||
uc->uc_nextvictim %= uc->uc_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to get an entry from the cache
|
||||
* return 1 if found, 0 if not found
|
||||
*/
|
||||
static int
|
||||
cache_get(xprt, msg, replyp, replylenp)
|
||||
SVCXPRT *xprt;
|
||||
struct rpc_msg *msg;
|
||||
char **replyp;
|
||||
u_long *replylenp;
|
||||
{
|
||||
u_int loc;
|
||||
register cache_ptr ent;
|
||||
register struct svcudp_data *su = su_data(xprt);
|
||||
register struct udp_cache *uc = (struct udp_cache *) su->su_cache;
|
||||
|
||||
# define EQADDR(a1, a2) (bcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0)
|
||||
|
||||
loc = CACHE_LOC(xprt, su->su_xid);
|
||||
for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next) {
|
||||
if (ent->cache_xid == su->su_xid &&
|
||||
ent->cache_proc == uc->uc_proc &&
|
||||
ent->cache_vers == uc->uc_vers &&
|
||||
ent->cache_prog == uc->uc_prog &&
|
||||
EQADDR(ent->cache_addr, uc->uc_addr)) {
|
||||
*replyp = ent->cache_reply;
|
||||
*replylenp = ent->cache_replylen;
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Failed to find entry
|
||||
* Remember a few things so we can do a set later
|
||||
*/
|
||||
uc->uc_proc = msg->rm_call.cb_proc;
|
||||
uc->uc_vers = msg->rm_call.cb_vers;
|
||||
uc->uc_prog = msg->rm_call.cb_prog;
|
||||
uc->uc_addr = xprt->xp_raddr;
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1,578 +0,0 @@
|
||||
/* @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
#if !defined(lint) && defined(SCCSIDS)
|
||||
static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xdr.c, Generic XDR routines implementation.
|
||||
*
|
||||
* Copyright (C) 1986, Sun Microsystems, Inc.
|
||||
*
|
||||
* These are the "generic" xdr routines used to serialize and de-serialize
|
||||
* most common data items. See xdr.h for more info on the interface to
|
||||
* xdr.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
|
||||
/*
|
||||
* constants specific to the xdr "protocol"
|
||||
*/
|
||||
#define XDR_FALSE ((long) 0)
|
||||
#define XDR_TRUE ((long) 1)
|
||||
#define LASTUNSIGNED ((u_int) 0-1)
|
||||
|
||||
/*
|
||||
* for unit alignment
|
||||
*/
|
||||
static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
|
||||
|
||||
/*
|
||||
* Free a data structure using XDR
|
||||
* Not a filter, but a convenient utility nonetheless
|
||||
*/
|
||||
void
|
||||
xdr_free(proc, objp)
|
||||
xdrproc_t proc;
|
||||
char *objp;
|
||||
{
|
||||
XDR x;
|
||||
|
||||
x.x_op = XDR_FREE;
|
||||
(*proc)(&x, objp);
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR nothing
|
||||
*/
|
||||
bool_t
|
||||
xdr_void(/* xdrs, addr */)
|
||||
/* XDR *xdrs; */
|
||||
/* caddr_t addr; */
|
||||
{
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_int(xdrs, ip)
|
||||
XDR *xdrs;
|
||||
int *ip;
|
||||
{
|
||||
|
||||
#ifdef lint
|
||||
(void) (xdr_short(xdrs, (short *)ip));
|
||||
return (xdr_long(xdrs, (long *)ip));
|
||||
#else
|
||||
if (sizeof (int) == sizeof (long)) {
|
||||
return (xdr_long(xdrs, (long *)ip));
|
||||
} else {
|
||||
return (xdr_short(xdrs, (short *)ip));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR unsigned integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_int(xdrs, up)
|
||||
XDR *xdrs;
|
||||
u_int *up;
|
||||
{
|
||||
|
||||
#ifdef lint
|
||||
(void) (xdr_short(xdrs, (short *)up));
|
||||
return (xdr_u_long(xdrs, (u_long *)up));
|
||||
#else
|
||||
if (sizeof (u_int) == sizeof (u_long)) {
|
||||
return (xdr_u_long(xdrs, (u_long *)up));
|
||||
} else {
|
||||
return (xdr_short(xdrs, (short *)up));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR long integers
|
||||
* same as xdr_u_long - open coded to save a proc call!
|
||||
*/
|
||||
bool_t
|
||||
xdr_long(xdrs, lp)
|
||||
register XDR *xdrs;
|
||||
long *lp;
|
||||
{
|
||||
|
||||
if (xdrs->x_op == XDR_ENCODE)
|
||||
return (XDR_PUTLONG(xdrs, lp));
|
||||
|
||||
if (xdrs->x_op == XDR_DECODE)
|
||||
return (XDR_GETLONG(xdrs, lp));
|
||||
|
||||
if (xdrs->x_op == XDR_FREE)
|
||||
return (TRUE);
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR unsigned long integers
|
||||
* same as xdr_long - open coded to save a proc call!
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_long(xdrs, ulp)
|
||||
register XDR *xdrs;
|
||||
u_long *ulp;
|
||||
{
|
||||
|
||||
if (xdrs->x_op == XDR_DECODE)
|
||||
return (XDR_GETLONG(xdrs, (long *)ulp));
|
||||
if (xdrs->x_op == XDR_ENCODE)
|
||||
return (XDR_PUTLONG(xdrs, (long *)ulp));
|
||||
if (xdrs->x_op == XDR_FREE)
|
||||
return (TRUE);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR short integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_short(xdrs, sp)
|
||||
register XDR *xdrs;
|
||||
short *sp;
|
||||
{
|
||||
long l;
|
||||
|
||||
switch (xdrs->x_op) {
|
||||
|
||||
case XDR_ENCODE:
|
||||
l = (long) *sp;
|
||||
return (XDR_PUTLONG(xdrs, &l));
|
||||
|
||||
case XDR_DECODE:
|
||||
if (!XDR_GETLONG(xdrs, &l)) {
|
||||
return (FALSE);
|
||||
}
|
||||
*sp = (short) l;
|
||||
return (TRUE);
|
||||
|
||||
case XDR_FREE:
|
||||
return (TRUE);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR unsigned short integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_short(xdrs, usp)
|
||||
register XDR *xdrs;
|
||||
u_short *usp;
|
||||
{
|
||||
u_long l;
|
||||
|
||||
switch (xdrs->x_op) {
|
||||
|
||||
case XDR_ENCODE:
|
||||
l = (u_long) *usp;
|
||||
return (XDR_PUTLONG(xdrs, &l));
|
||||
|
||||
case XDR_DECODE:
|
||||
if (!XDR_GETLONG(xdrs, &l)) {
|
||||
return (FALSE);
|
||||
}
|
||||
*usp = (u_short) l;
|
||||
return (TRUE);
|
||||
|
||||
case XDR_FREE:
|
||||
return (TRUE);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* XDR a char
|
||||
*/
|
||||
bool_t
|
||||
xdr_char(xdrs, cp)
|
||||
XDR *xdrs;
|
||||
char *cp;
|
||||
{
|
||||
int i;
|
||||
|
||||
i = (*cp);
|
||||
if (!xdr_int(xdrs, &i)) {
|
||||
return (FALSE);
|
||||
}
|
||||
*cp = i;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR an unsigned char
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_char(xdrs, cp)
|
||||
XDR *xdrs;
|
||||
char *cp;
|
||||
{
|
||||
u_int u;
|
||||
|
||||
u = (*cp);
|
||||
if (!xdr_u_int(xdrs, &u)) {
|
||||
return (FALSE);
|
||||
}
|
||||
*cp = u;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR booleans
|
||||
*/
|
||||
bool_t
|
||||
xdr_bool(xdrs, bp)
|
||||
register XDR *xdrs;
|
||||
bool_t *bp;
|
||||
{
|
||||
long lb;
|
||||
|
||||
switch (xdrs->x_op) {
|
||||
|
||||
case XDR_ENCODE:
|
||||
lb = *bp ? XDR_TRUE : XDR_FALSE;
|
||||
return (XDR_PUTLONG(xdrs, &lb));
|
||||
|
||||
case XDR_DECODE:
|
||||
if (!XDR_GETLONG(xdrs, &lb)) {
|
||||
return (FALSE);
|
||||
}
|
||||
*bp = (lb == XDR_FALSE) ? FALSE : TRUE;
|
||||
return (TRUE);
|
||||
|
||||
case XDR_FREE:
|
||||
return (TRUE);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR enumerations
|
||||
*/
|
||||
bool_t
|
||||
xdr_enum(xdrs, ep)
|
||||
XDR *xdrs;
|
||||
enum_t *ep;
|
||||
{
|
||||
#ifndef lint
|
||||
enum sizecheck { SIZEVAL }; /* used to find the size of an enum */
|
||||
|
||||
/*
|
||||
* enums are treated as ints
|
||||
*/
|
||||
if (sizeof (enum sizecheck) == sizeof (long)) {
|
||||
return (xdr_long(xdrs, (long *)ep));
|
||||
} else if (sizeof (enum sizecheck) == sizeof (short)) {
|
||||
return (xdr_short(xdrs, (short *)ep));
|
||||
} else {
|
||||
return (FALSE);
|
||||
}
|
||||
#else
|
||||
(void) (xdr_short(xdrs, (short *)ep));
|
||||
return (xdr_long(xdrs, (long *)ep));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR opaque data
|
||||
* Allows the specification of a fixed size sequence of opaque bytes.
|
||||
* cp points to the opaque object and cnt gives the byte length.
|
||||
*/
|
||||
bool_t
|
||||
xdr_opaque(xdrs, cp, cnt)
|
||||
register XDR *xdrs;
|
||||
caddr_t cp;
|
||||
register u_int cnt;
|
||||
{
|
||||
register u_int rndup;
|
||||
static int crud[BYTES_PER_XDR_UNIT];
|
||||
|
||||
/*
|
||||
* if no data we are done
|
||||
*/
|
||||
if (cnt == 0)
|
||||
return (TRUE);
|
||||
|
||||
/*
|
||||
* round byte count to full xdr units
|
||||
*/
|
||||
rndup = cnt % BYTES_PER_XDR_UNIT;
|
||||
if (rndup > 0)
|
||||
rndup = BYTES_PER_XDR_UNIT - rndup;
|
||||
|
||||
if (xdrs->x_op == XDR_DECODE) {
|
||||
if (!XDR_GETBYTES(xdrs, cp, cnt)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (rndup == 0)
|
||||
return (TRUE);
|
||||
return (XDR_GETBYTES(xdrs, crud, rndup));
|
||||
}
|
||||
|
||||
if (xdrs->x_op == XDR_ENCODE) {
|
||||
if (!XDR_PUTBYTES(xdrs, cp, cnt)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (rndup == 0)
|
||||
return (TRUE);
|
||||
return (XDR_PUTBYTES(xdrs, xdr_zero, rndup));
|
||||
}
|
||||
|
||||
if (xdrs->x_op == XDR_FREE) {
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR counted bytes
|
||||
* *cpp is a pointer to the bytes, *sizep is the count.
|
||||
* If *cpp is NULL maxsize bytes are allocated
|
||||
*/
|
||||
bool_t
|
||||
xdr_bytes(xdrs, cpp, sizep, maxsize)
|
||||
register XDR *xdrs;
|
||||
char **cpp;
|
||||
register u_int *sizep;
|
||||
u_int maxsize;
|
||||
{
|
||||
register char *sp = *cpp; /* sp is the actual string pointer */
|
||||
register u_int nodesize;
|
||||
|
||||
/*
|
||||
* first deal with the length since xdr bytes are counted
|
||||
*/
|
||||
if (! xdr_u_int(xdrs, sizep)) {
|
||||
return (FALSE);
|
||||
}
|
||||
nodesize = *sizep;
|
||||
if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* now deal with the actual bytes
|
||||
*/
|
||||
switch (xdrs->x_op) {
|
||||
|
||||
case XDR_DECODE:
|
||||
if (nodesize == 0) {
|
||||
return (TRUE);
|
||||
}
|
||||
if (sp == NULL) {
|
||||
*cpp = sp = (char *)mem_alloc(nodesize);
|
||||
}
|
||||
if (sp == NULL) {
|
||||
(void) printf("xdr_bytes: out of memory\n");
|
||||
return (FALSE);
|
||||
}
|
||||
/* fall into ... */
|
||||
|
||||
case XDR_ENCODE:
|
||||
return (xdr_opaque(xdrs, sp, nodesize));
|
||||
|
||||
case XDR_FREE:
|
||||
if (sp != NULL) {
|
||||
mem_free(sp, nodesize);
|
||||
*cpp = NULL;
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Implemented here due to commonality of the object.
|
||||
*/
|
||||
bool_t
|
||||
xdr_netobj(xdrs, np)
|
||||
XDR *xdrs;
|
||||
struct netobj *np;
|
||||
{
|
||||
|
||||
return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ));
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR a descriminated union
|
||||
* Support routine for discriminated unions.
|
||||
* You create an array of xdrdiscrim structures, terminated with
|
||||
* an entry with a null procedure pointer. The routine gets
|
||||
* the discriminant value and then searches the array of xdrdiscrims
|
||||
* looking for that value. It calls the procedure given in the xdrdiscrim
|
||||
* to handle the discriminant. If there is no specific routine a default
|
||||
* routine may be called.
|
||||
* If there is no specific or default routine an error is returned.
|
||||
*/
|
||||
bool_t
|
||||
xdr_union(xdrs, dscmp, unp, choices, dfault)
|
||||
register XDR *xdrs;
|
||||
enum_t *dscmp; /* enum to decide which arm to work on */
|
||||
char *unp; /* the union itself */
|
||||
struct xdr_discrim *choices; /* [value, xdr proc] for each arm */
|
||||
xdrproc_t dfault; /* default xdr routine */
|
||||
{
|
||||
register enum_t dscm;
|
||||
|
||||
/*
|
||||
* we deal with the discriminator; it's an enum
|
||||
*/
|
||||
if (! xdr_enum(xdrs, dscmp)) {
|
||||
return (FALSE);
|
||||
}
|
||||
dscm = *dscmp;
|
||||
|
||||
/*
|
||||
* search choices for a value that matches the discriminator.
|
||||
* if we find one, execute the xdr routine for that value.
|
||||
*/
|
||||
for (; choices->proc != NULL_xdrproc_t; choices++) {
|
||||
if (choices->value == dscm)
|
||||
return ((*(choices->proc))(xdrs, unp, LASTUNSIGNED));
|
||||
}
|
||||
|
||||
/*
|
||||
* no match - execute the default xdr routine if there is one
|
||||
*/
|
||||
return ((dfault == NULL_xdrproc_t) ? FALSE :
|
||||
(*dfault)(xdrs, unp, LASTUNSIGNED));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Non-portable xdr primitives.
|
||||
* Care should be taken when moving these routines to new architectures.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XDR null terminated ASCII strings
|
||||
* xdr_string deals with "C strings" - arrays of bytes that are
|
||||
* terminated by a NULL character. The parameter cpp references a
|
||||
* pointer to storage; If the pointer is null, then the necessary
|
||||
* storage is allocated. The last parameter is the max allowed length
|
||||
* of the string as specified by a protocol.
|
||||
*/
|
||||
bool_t
|
||||
xdr_string(xdrs, cpp, maxsize)
|
||||
register XDR *xdrs;
|
||||
char **cpp;
|
||||
u_int maxsize;
|
||||
{
|
||||
register char *sp = *cpp; /* sp is the actual string pointer */
|
||||
u_int size;
|
||||
u_int nodesize;
|
||||
|
||||
/*
|
||||
* first deal with the length since xdr strings are counted-strings
|
||||
*/
|
||||
switch (xdrs->x_op) {
|
||||
case XDR_FREE:
|
||||
if (sp == NULL) {
|
||||
return(TRUE); /* already free */
|
||||
}
|
||||
/* fall through... */
|
||||
case XDR_ENCODE:
|
||||
size = strlen(sp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (! xdr_u_int(xdrs, &size)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (size > maxsize) {
|
||||
return (FALSE);
|
||||
}
|
||||
nodesize = size + 1;
|
||||
|
||||
/*
|
||||
* now deal with the actual bytes
|
||||
*/
|
||||
switch (xdrs->x_op) {
|
||||
|
||||
case XDR_DECODE:
|
||||
if (nodesize == 0) {
|
||||
return (TRUE);
|
||||
}
|
||||
if (sp == NULL)
|
||||
*cpp = sp = (char *)mem_alloc(nodesize);
|
||||
if (sp == NULL) {
|
||||
(void) printf("xdr_string: out of memory\n");
|
||||
return (FALSE);
|
||||
}
|
||||
sp[size] = 0;
|
||||
/* fall into ... */
|
||||
|
||||
case XDR_ENCODE:
|
||||
return (xdr_opaque(xdrs, sp, size));
|
||||
|
||||
case XDR_FREE:
|
||||
mem_free(sp, nodesize);
|
||||
*cpp = NULL;
|
||||
return (TRUE);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wrapper for xdr_string that can be called directly from
|
||||
* routines like clnt_call
|
||||
*/
|
||||
bool_t
|
||||
xdr_wrapstring(xdrs, cpp)
|
||||
XDR *xdrs;
|
||||
char **cpp;
|
||||
{
|
||||
if (xdr_string(xdrs, cpp, LASTUNSIGNED)) {
|
||||
return (TRUE);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
/* @(#)xdr_array.c 2.1 88/07/29 4.0 RPCSRC */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
#if !defined(lint) && defined(SCCSIDS)
|
||||
static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xdr_array.c, Generic XDR routines impelmentation.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*
|
||||
* These are the "non-trivial" xdr primitives used to serialize and de-serialize
|
||||
* arrays. See xdr.h for more info on the interface to xdr.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h> /* printf */
|
||||
#include <string.h> /* bcmp */
|
||||
#include <stdlib.h> /* free */
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
|
||||
#define LASTUNSIGNED ((u_int)0-1)
|
||||
|
||||
|
||||
/*
|
||||
* XDR an array of arbitrary elements
|
||||
* *addrp is a pointer to the array, *sizep is the number of elements.
|
||||
* If addrp is NULL (*sizep * elsize) bytes are allocated.
|
||||
* elsize is the size (in bytes) of each element, and elproc is the
|
||||
* xdr procedure to call to handle each element of the array.
|
||||
*/
|
||||
bool_t
|
||||
xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
|
||||
register XDR *xdrs;
|
||||
caddr_t *addrp; /* array pointer */
|
||||
u_int *sizep; /* number of elements */
|
||||
u_int maxsize; /* max numberof elements */
|
||||
u_int elsize; /* size in bytes of each element */
|
||||
xdrproc_t elproc; /* xdr routine to handle each element */
|
||||
{
|
||||
register u_int i;
|
||||
register caddr_t target = *addrp;
|
||||
register u_int c; /* the actual element count */
|
||||
register bool_t stat = TRUE;
|
||||
register u_int nodesize;
|
||||
|
||||
/* like strings, arrays are really counted arrays */
|
||||
if (! xdr_u_int(xdrs, sizep)) {
|
||||
return (FALSE);
|
||||
}
|
||||
c = *sizep;
|
||||
if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) {
|
||||
return (FALSE);
|
||||
}
|
||||
nodesize = c * elsize;
|
||||
|
||||
/*
|
||||
* if we are deserializing, we may need to allocate an array.
|
||||
* We also save time by checking for a null array if we are freeing.
|
||||
*/
|
||||
if (target == NULL)
|
||||
switch (xdrs->x_op) {
|
||||
case XDR_DECODE:
|
||||
if (c == 0)
|
||||
return (TRUE);
|
||||
*addrp = target = mem_alloc(nodesize);
|
||||
if (target == NULL) {
|
||||
(void) printf(
|
||||
"xdr_array: out of memory\n");
|
||||
return (FALSE);
|
||||
}
|
||||
bzero(target, nodesize);
|
||||
break;
|
||||
|
||||
case XDR_FREE:
|
||||
return (TRUE);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* now we xdr each element of array
|
||||
*/
|
||||
for (i = 0; (i < c) && stat; i++) {
|
||||
stat = (*elproc)(xdrs, target, LASTUNSIGNED);
|
||||
target += elsize;
|
||||
}
|
||||
|
||||
/*
|
||||
* the array may need freeing
|
||||
*/
|
||||
if (xdrs->x_op == XDR_FREE) {
|
||||
mem_free(*addrp, nodesize);
|
||||
*addrp = NULL;
|
||||
}
|
||||
return (stat);
|
||||
}
|
||||
|
||||
/*
|
||||
* xdr_vector():
|
||||
*
|
||||
* XDR a fixed length array. Unlike variable-length arrays,
|
||||
* the storage of fixed length arrays is static and unfreeable.
|
||||
* > basep: base of the array
|
||||
* > size: size of the array
|
||||
* > elemsize: size of each element
|
||||
* > xdr_elem: routine to XDR each element
|
||||
*/
|
||||
bool_t
|
||||
xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem)
|
||||
register XDR *xdrs;
|
||||
register char *basep;
|
||||
register u_int nelem;
|
||||
register u_int elemsize;
|
||||
register xdrproc_t xdr_elem;
|
||||
{
|
||||
register u_int i;
|
||||
register char *elptr;
|
||||
|
||||
elptr = basep;
|
||||
for (i = 0; i < nelem; i++) {
|
||||
if (! (*xdr_elem)(xdrs, elptr, LASTUNSIGNED)) {
|
||||
return(FALSE);
|
||||
}
|
||||
elptr += elemsize;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
/* @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
#if !defined(lint) && defined(SCCSIDS)
|
||||
static char sccsid[] = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xdr_mem.h, XDR implementation using memory buffers.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*
|
||||
* If you have some data to be interpreted as external data representation
|
||||
* or to be converted to external data representation in a memory buffer,
|
||||
* then this is the package for you.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h> /* bcopy */
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
static bool_t xdrmem_getlong();
|
||||
static bool_t xdrmem_putlong();
|
||||
static bool_t xdrmem_getbytes();
|
||||
static bool_t xdrmem_putbytes();
|
||||
static u_int xdrmem_getpos();
|
||||
static bool_t xdrmem_setpos();
|
||||
static long * xdrmem_inline();
|
||||
static void xdrmem_destroy();
|
||||
|
||||
static struct xdr_ops xdrmem_ops = {
|
||||
xdrmem_getlong,
|
||||
xdrmem_putlong,
|
||||
xdrmem_getbytes,
|
||||
xdrmem_putbytes,
|
||||
xdrmem_getpos,
|
||||
xdrmem_setpos,
|
||||
xdrmem_inline,
|
||||
xdrmem_destroy
|
||||
};
|
||||
|
||||
/*
|
||||
* The procedure xdrmem_create initializes a stream descriptor for a
|
||||
* memory buffer.
|
||||
*/
|
||||
void
|
||||
xdrmem_create(xdrs, addr, size, op)
|
||||
register XDR *xdrs;
|
||||
caddr_t addr;
|
||||
u_int size;
|
||||
enum xdr_op op;
|
||||
{
|
||||
|
||||
xdrs->x_op = op;
|
||||
xdrs->x_ops = &xdrmem_ops;
|
||||
xdrs->x_private = xdrs->x_base = addr;
|
||||
xdrs->x_handy = size;
|
||||
}
|
||||
|
||||
static void
|
||||
xdrmem_destroy(/*xdrs*/)
|
||||
/*XDR *xdrs;*/
|
||||
{
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_getlong(xdrs, lp)
|
||||
register XDR *xdrs;
|
||||
long *lp;
|
||||
{
|
||||
|
||||
if ((xdrs->x_handy -= sizeof(long)) < 0)
|
||||
return (FALSE);
|
||||
*lp = (long)ntohl((u_long)(*((long *)(xdrs->x_private))));
|
||||
xdrs->x_private += sizeof(long);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_putlong(xdrs, lp)
|
||||
register XDR *xdrs;
|
||||
long *lp;
|
||||
{
|
||||
|
||||
if ((xdrs->x_handy -= sizeof(long)) < 0)
|
||||
return (FALSE);
|
||||
*(long *)xdrs->x_private = (long)htonl((u_long)(*lp));
|
||||
xdrs->x_private += sizeof(long);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_getbytes(xdrs, addr, len)
|
||||
register XDR *xdrs;
|
||||
caddr_t addr;
|
||||
register u_int len;
|
||||
{
|
||||
|
||||
if ((xdrs->x_handy -= len) < 0)
|
||||
return (FALSE);
|
||||
bcopy(xdrs->x_private, addr, len);
|
||||
xdrs->x_private += len;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_putbytes(xdrs, addr, len)
|
||||
register XDR *xdrs;
|
||||
caddr_t addr;
|
||||
register u_int len;
|
||||
{
|
||||
|
||||
if ((xdrs->x_handy -= len) < 0)
|
||||
return (FALSE);
|
||||
bcopy(addr, xdrs->x_private, len);
|
||||
xdrs->x_private += len;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static u_int
|
||||
xdrmem_getpos(xdrs)
|
||||
register XDR *xdrs;
|
||||
{
|
||||
|
||||
return ((u_int)xdrs->x_private - (u_int)xdrs->x_base);
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_setpos(xdrs, pos)
|
||||
register XDR *xdrs;
|
||||
u_int pos;
|
||||
{
|
||||
register caddr_t newaddr = xdrs->x_base + pos;
|
||||
register caddr_t lastaddr = xdrs->x_private + xdrs->x_handy;
|
||||
|
||||
if ((long)newaddr > (long)lastaddr)
|
||||
return (FALSE);
|
||||
xdrs->x_private = newaddr;
|
||||
xdrs->x_handy = (int)lastaddr - (int)newaddr;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static long *
|
||||
xdrmem_inline(xdrs, len)
|
||||
register XDR *xdrs;
|
||||
int len;
|
||||
{
|
||||
long *buf = 0;
|
||||
|
||||
if (xdrs->x_handy >= len) {
|
||||
xdrs->x_handy -= len;
|
||||
buf = (long *) xdrs->x_private;
|
||||
xdrs->x_private += len;
|
||||
}
|
||||
return (buf);
|
||||
}
|
||||
@@ -29,8 +29,6 @@ RTEMS_CANONICALIZE_TOOLS
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# try to explicitly list a Makefile here
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
|
||||
@@ -29,8 +29,6 @@ RTEMS_CANONICALIZE_TOOLS
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# try to explicitly list a Makefile here
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
|
||||
@@ -28,7 +28,6 @@ RTEMS_PROG_CC_FOR_TARGET
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# try to explicitly list a Makefile here
|
||||
AC_OUTPUT(
|
||||
|
||||
@@ -28,7 +28,6 @@ RTEMS_PROG_CC_FOR_TARGET
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# try to explicitly list a Makefile here
|
||||
AC_OUTPUT(
|
||||
|
||||
@@ -28,7 +28,6 @@ RTEMS_PROG_CC_FOR_TARGET
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# try to explicitly list a Makefile here
|
||||
AC_OUTPUT(
|
||||
|
||||
@@ -29,8 +29,6 @@ RTEMS_CANONICALIZE_TOOLS
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# pick up all the Makefiles in required parts of the tree
|
||||
if test "$RTEMS_CPU" = "unix"; then
|
||||
## HACK: Suppress libchip for unix
|
||||
|
||||
@@ -30,8 +30,6 @@ RTEMS_CANONICALIZE_TOOLS
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
|
||||
# try to explicitly list a Makefile here
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
|
||||
@@ -15,6 +15,7 @@ AC_PROG_INSTALL
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
RTEMS_ENABLE_NETWORKING
|
||||
RTEMS_ENABLE_RDBG
|
||||
RTEMS_ENABLE_LIBCDIR
|
||||
RTEMS_ENABLE_BARE
|
||||
|
||||
@@ -40,10 +41,9 @@ if test "$AWK" = "no"; then
|
||||
fi
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
RTEMS_CHECK_RDBG(RTEMS_BSP)
|
||||
|
||||
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
RTEMS_CHECK_RDBG(bspdir)
|
||||
|
||||
# Try to explicitly list a Makefile here
|
||||
AC_OUTPUT(
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = .
|
||||
top_builddir = ..
|
||||
subdir = src
|
||||
|
||||
RTEMS_ROOT = @RTEMS_ROOT@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
@@ -54,4 +55,4 @@ $(LIB): $(SRCS) ${OBJS}
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
@@ -8,7 +8,6 @@ RTEMS_TOP(../../..)
|
||||
AC_CONFIG_AUX_DIR(../../..)
|
||||
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
RTEMS_PROJECT_ROOT
|
||||
RTEMS_CANONICAL_HOST
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-c-src-librtems++,$RTEMS_VERSION,no)
|
||||
@@ -33,6 +32,8 @@ AM_CONDITIONAL(HAS_CXX,test "$HAS_CPLUSPLUS" = "yes")
|
||||
PROJECT_INCLUDE="\$(PROJECT_ROOT)/$RTEMS_BSP/lib/include"
|
||||
AC_SUBST(PROJECT_INCLUDE)
|
||||
|
||||
RTEMS_PROJECT_ROOT
|
||||
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
include/Makefile
|
||||
|
||||
@@ -70,10 +70,10 @@ RTEMS_I386_GAS_CODE16
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_CHECK_MULTIPROCESSING(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
RTEMS_CHECK_RDBG(RTEMS_BSP)
|
||||
RTEMS_CHECK_POSIX_API(RTEMS_BSP)
|
||||
RTEMS_CHECK_CXX(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
|
||||
AC_SUBST(rtems_cv_prog_cc_cross)
|
||||
AC_SUBST(RTEMS_HAS_CPLUSPLUS)
|
||||
|
||||
@@ -12,6 +12,7 @@ RTEMS_CANONICAL_TARGET_CPU
|
||||
AM_INIT_AUTOMAKE(rtems-c-src-tests-support,$RTEMS_VERSION,no)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
RTEMS_ENABLE_POSIX
|
||||
RTEMS_ENV_RTEMSBSP
|
||||
RTEMS_CHECK_CPU
|
||||
RTEMS_CANONICAL_HOST
|
||||
@@ -20,7 +21,6 @@ RTEMS_PROJECT_ROOT
|
||||
|
||||
dnl check target cc
|
||||
RTEMS_PROG_CC_FOR_TARGET
|
||||
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
|
||||
@@ -3,9 +3,9 @@ dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT(generic)
|
||||
RTEMS_TOP(../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../..)
|
||||
|
||||
RTEMS_TOP(../../../..)
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-tests-tools,$RTEMS_VERSION,no)
|
||||
|
||||
@@ -3,9 +3,9 @@ dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT(sorttimes.in)
|
||||
RTEMS_TOP(../../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../../..)
|
||||
|
||||
RTEMS_TOP(../../../../..)
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
|
||||
AM_INIT_AUTOMAKE(rtems-tests-tools-generic,$RTEMS_VERSION,no)
|
||||
|
||||
Reference in New Issue
Block a user