sheep and dog codes are no longer used Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp> --- configure | 5845 -------------------- configure.in | 1 - dog/Makefile.in | 17 - dog/build.xml | 70 - dog/conf/log4j.xml | 21 - dog/conf/manifest.in | 3 - dog/conf/sd.xml | 37 - dog/dog.in | 37 - dog/src/net/osrg/sheepdog/ClusterInformation.java | 173 - dog/src/net/osrg/sheepdog/Connection.java | 202 - dog/src/net/osrg/sheepdog/ConnectionCallback.java | 22 - dog/src/net/osrg/sheepdog/DirEntry.java | 123 - dog/src/net/osrg/sheepdog/Inode.java | 145 - dog/src/net/osrg/sheepdog/Log.java | 80 - dog/src/net/osrg/sheepdog/Master.java | 325 -- dog/src/net/osrg/sheepdog/MasterGroup.java | 160 - dog/src/net/osrg/sheepdog/Node.java | 183 - dog/src/net/osrg/sheepdog/NodeList.java | 174 - dog/src/net/osrg/sheepdog/NodeLogOperator.java | 161 - dog/src/net/osrg/sheepdog/ObjectOperator.java | 237 - dog/src/net/osrg/sheepdog/OpCode.java | 71 - dog/src/net/osrg/sheepdog/Sheepdog.java | 762 --- dog/src/net/osrg/sheepdog/SheepdogException.java | 73 - dog/src/net/osrg/sheepdog/SuperObject.java | 198 - dog/src/net/osrg/sheepdog/VdiOperator.java | 249 - dog/src/net/osrg/sheepdog/headers/NodeRequest.java | 47 - .../net/osrg/sheepdog/headers/NodeResponse.java | 65 - .../net/osrg/sheepdog/headers/ObjectRequest.java | 119 - .../net/osrg/sheepdog/headers/ObjectResponse.java | 50 - dog/src/net/osrg/sheepdog/headers/Request.java | 170 - dog/src/net/osrg/sheepdog/headers/Response.java | 165 - dog/src/net/osrg/sheepdog/headers/VdiRequest.java | 68 - dog/src/net/osrg/sheepdog/headers/VdiResponse.java | 75 - .../net/osrg/sheepdog/messages/DelVdiMessage.java | 41 - .../osrg/sheepdog/messages/GetVdiInfoMessage.java | 99 - .../osrg/sheepdog/messages/GetVmListMessage.java | 50 - .../net/osrg/sheepdog/messages/JoinMessage.java | 113 - .../net/osrg/sheepdog/messages/LeaveMessage.java | 69 - .../net/osrg/sheepdog/messages/MakeFsMessage.java | 64 - .../sheepdog/messages/MasterChangedMessage.java | 42 - .../net/osrg/sheepdog/messages/NewVdiMessage.java | 79 - .../osrg/sheepdog/messages/ReleaseVdiMessage.java | 65 - .../messages/RequestClusterInfoMessage.java | 63 - .../osrg/sheepdog/messages/SheepdogMessage.java | 67 - .../osrg/sheepdog/messages/ShutdownMessage.java | 37 - .../osrg/sheepdog/messages/UpdateEpochMessage.java | 62 - install-sh | 323 -- sheep/Makefile.in | 31 - sheep/net.c | 292 - sheep/sheep.c | 225 - sheep/sheep.h | 66 - sheep/store.c | 460 -- sheep/work.c | 234 - sheep/work.h | 20 - 54 files changed, 0 insertions(+), 12630 deletions(-) delete mode 100755 configure delete mode 100644 dog/Makefile.in delete mode 100644 dog/build.xml delete mode 100644 dog/conf/log4j.xml delete mode 100644 dog/conf/manifest.in delete mode 100644 dog/conf/sd.xml delete mode 100644 dog/dog.in delete mode 100644 dog/src/net/osrg/sheepdog/ClusterInformation.java delete mode 100644 dog/src/net/osrg/sheepdog/Connection.java delete mode 100644 dog/src/net/osrg/sheepdog/ConnectionCallback.java delete mode 100644 dog/src/net/osrg/sheepdog/DirEntry.java delete mode 100644 dog/src/net/osrg/sheepdog/Inode.java delete mode 100644 dog/src/net/osrg/sheepdog/Log.java delete mode 100644 dog/src/net/osrg/sheepdog/Master.java delete mode 100644 dog/src/net/osrg/sheepdog/MasterGroup.java delete mode 100644 dog/src/net/osrg/sheepdog/Node.java delete mode 100644 dog/src/net/osrg/sheepdog/NodeList.java delete mode 100644 dog/src/net/osrg/sheepdog/NodeLogOperator.java delete mode 100644 dog/src/net/osrg/sheepdog/ObjectOperator.java delete mode 100644 dog/src/net/osrg/sheepdog/OpCode.java delete mode 100644 dog/src/net/osrg/sheepdog/Sheepdog.java delete mode 100644 dog/src/net/osrg/sheepdog/SheepdogException.java delete mode 100644 dog/src/net/osrg/sheepdog/SuperObject.java delete mode 100644 dog/src/net/osrg/sheepdog/VdiOperator.java delete mode 100644 dog/src/net/osrg/sheepdog/headers/NodeRequest.java delete mode 100644 dog/src/net/osrg/sheepdog/headers/NodeResponse.java delete mode 100644 dog/src/net/osrg/sheepdog/headers/ObjectRequest.java delete mode 100644 dog/src/net/osrg/sheepdog/headers/ObjectResponse.java delete mode 100644 dog/src/net/osrg/sheepdog/headers/Request.java delete mode 100644 dog/src/net/osrg/sheepdog/headers/Response.java delete mode 100644 dog/src/net/osrg/sheepdog/headers/VdiRequest.java delete mode 100644 dog/src/net/osrg/sheepdog/headers/VdiResponse.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/DelVdiMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/GetVdiInfoMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/GetVmListMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/JoinMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/LeaveMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/MakeFsMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/MasterChangedMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/NewVdiMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/ReleaseVdiMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/RequestClusterInfoMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/SheepdogMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/ShutdownMessage.java delete mode 100644 dog/src/net/osrg/sheepdog/messages/UpdateEpochMessage.java delete mode 100755 install-sh delete mode 100644 sheep/Makefile.in delete mode 100644 sheep/net.c delete mode 100644 sheep/sheep.c delete mode 100644 sheep/sheep.h delete mode 100644 sheep/store.c delete mode 100644 sheep/work.c delete mode 100644 sheep/work.h diff --git a/configure b/configure deleted file mode 100755 index 69d7e8c..0000000 --- a/configure +++ /dev/null @@ -1,5845 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64. -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software -# Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf at gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. -as_fn_error () -{ - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi - $as_echo "$as_me: error: $1" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 7<&0 </dev/null 6>&1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="lib/net.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include <stdio.h> -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif -#ifdef HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif -#ifdef STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#else -# ifdef HAVE_STDLIB_H -# include <stdlib.h> -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include <memory.h> -# endif -# include <string.h> -#endif -#ifdef HAVE_STRINGS_H -# include <strings.h> -#endif -#ifdef HAVE_INTTYPES_H -# include <inttypes.h> -#endif -#ifdef HAVE_STDINT_H -# include <stdint.h> -#endif -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif" - -ac_subst_vars='LTLIBOBJS -LIBOBJS -EGREP -GREP -CPP -JSVC -ANT -JAVA_LIB -JAVA_HOME -SET_MAKE -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a - nonstandard directory <lib dir> - LIBS libraries to pass to the linker, e.g. -l<library> - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if - you have headers in a nonstandard directory <include dir> - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.64 - -Copyright (C) 2009 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_compile - -# ac_fn_c_find_intX_t LINENO BITS VAR -# ----------------------------------- -# Finds a signed integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_intX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 -$as_echo_n "checking for int$2_t... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - for ac_type in int$2_t 'int' 'long int' \ - 'long long int' 'short int' 'signed char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << ($2 - 2)) - 1) * 2 + 1))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << ($2 - 2)) - 1) * 2 + 1) - < ($ac_type) (((($ac_type) 1 << ($2 - 2)) - 1) * 2 + 2))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - case $ac_type in #( - int$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval as_val=\$$3 - if test "x$as_val" = x""no; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_find_intX_t - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_type - -# ac_fn_c_find_uintX_t LINENO BITS VAR -# ------------------------------------ -# Finds an unsigned integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_uintX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -$as_echo_n "checking for uint$2_t... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) -1 >> ($2 - 1) == 1)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - case $ac_type in #( - uint$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval as_val=\$$3 - if test "x$as_val" = x""no; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_find_uintX_t - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case <limits.h> declares $2. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_func -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.64. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - -# Checks for programs. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - rm -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdio.h> -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -if test -z "$ac_file"; then : - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } -fi -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdarg.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done -done -if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -if test "$JAVA_HOME" = ""; then - JAVA_HOME=/usr/lib/jvm/java-6-sun -fi -JAVA_HOME=$JAVA_HOME - -as_ac_File=`$as_echo "ac_cv_file_$JAVA_HOME/bin/java" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $JAVA_HOME/bin/java" >&5 -$as_echo_n "checking for $JAVA_HOME/bin/java... " >&6; } -if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "$JAVA_HOME/bin/java"; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_File - if test "x$as_val" = x""yes; then : - -else - as_fn_error "\"install sun-java6-sdk and define JAVA_HOME to be the root of your Java installation\"" "$LINENO" 5 -fi - -as_ac_File=`$as_echo "ac_cv_file_$JAVA_HOME/bin/javac" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $JAVA_HOME/bin/javac" >&5 -$as_echo_n "checking for $JAVA_HOME/bin/javac... " >&6; } -if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "$JAVA_HOME/bin/javac"; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_File - if test "x$as_val" = x""yes; then : - -else - as_fn_error "\"install sun-java6-sdk and define JAVA_HOME to be the root of your Java installation\"" "$LINENO" 5 -fi - -as_ac_File=`$as_echo "ac_cv_file_$JAVA_HOME/bin/jar" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $JAVA_HOME/bin/jar" >&5 -$as_echo_n "checking for $JAVA_HOME/bin/jar... " >&6; } -if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "$JAVA_HOME/bin/jar"; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_File - if test "x$as_val" = x""yes; then : - -else - as_fn_error "\"install sun-java6-sdk and define JAVA_HOME to be the root of your Java installation\"" "$LINENO" 5 -fi - -if test "$JAVA_LIB" = ""; then - JAVA_LIB=/usr/share/java -fi -JAVA_LIB=$JAVA_LIB - -as_ac_File=`$as_echo "ac_cv_file_$JAVA_LIB/jgroups-all.jar" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $JAVA_LIB/jgroups-all.jar" >&5 -$as_echo_n "checking for $JAVA_LIB/jgroups-all.jar... " >&6; } -if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "$JAVA_LIB/jgroups-all.jar"; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_File - if test "x$as_val" = x""yes; then : - -else - as_fn_error "\"install libjgroups-java and define JAVA_LIB to be the root of the installation\"" "$LINENO" 5 -fi - -as_ac_File=`$as_echo "ac_cv_file_$JAVA_LIB/commons-daemon.jar" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $JAVA_LIB/commons-daemon.jar" >&5 -$as_echo_n "checking for $JAVA_LIB/commons-daemon.jar... " >&6; } -if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "$JAVA_LIB/commons-daemon.jar"; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_File - if test "x$as_val" = x""yes; then : - -else - as_fn_error "\"install libcommons-daemon-java and define JAVA_LIB to be the root of the installation\"" "$LINENO" 5 -fi - -as_ac_File=`$as_echo "ac_cv_file_$JAVA_LIB/commons-cli.jar" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $JAVA_LIB/commons-cli.jar" >&5 -$as_echo_n "checking for $JAVA_LIB/commons-cli.jar... " >&6; } -if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "$JAVA_LIB/commons-cli.jar"; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_File - if test "x$as_val" = x""yes; then : - -else - as_fn_error "\"install libcommons-cli-java and define JAVA_LIB to be the root of the installation\"" "$LINENO" 5 -fi - -as_ac_File=`$as_echo "ac_cv_file_$JAVA_LIB/commons-logging.jar" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $JAVA_LIB/commons-logging.jar" >&5 -$as_echo_n "checking for $JAVA_LIB/commons-logging.jar... " >&6; } -if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "$JAVA_LIB/commons-logging.jar"; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_File - if test "x$as_val" = x""yes; then : - -else - as_fn_error "\"install libcommons-logging-java and define JAVA_LIB to be the root of the installation\"" "$LINENO" 5 -fi - -as_ac_File=`$as_echo "ac_cv_file_$JAVA_LIB/log4j-1.2.jar" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $JAVA_LIB/log4j-1.2.jar" >&5 -$as_echo_n "checking for $JAVA_LIB/log4j-1.2.jar... " >&6; } -if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "$JAVA_LIB/log4j-1.2.jar"; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_File - if test "x$as_val" = x""yes; then : - -else - as_fn_error "\"install liblog4j1.2-java and define JAVA_LIB to be the root of the installation\"" "$LINENO" 5 -fi - -# Extract the first word of "ant", so it can be a program name with args. -set dummy ant; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ANT+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ANT"; then - ac_cv_prog_ANT="$ANT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ANT="ant" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_prog_ANT" && ac_cv_prog_ANT="no" -fi -fi -ANT=$ac_cv_prog_ANT -if test -n "$ANT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANT" >&5 -$as_echo "$ANT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -if test "$ANT" = no ; then - as_fn_error "could not find ant" "$LINENO" 5 -fi -# Extract the first word of "jsvc", so it can be a program name with args. -set dummy jsvc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_JSVC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$JSVC"; then - ac_cv_prog_JSVC="$JSVC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_JSVC="jsvc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_prog_JSVC" && ac_cv_prog_JSVC="no" -fi -fi -JSVC=$ac_cv_prog_JSVC -if test -n "$JSVC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JSVC" >&5 -$as_echo "$JSVC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -if test "$JSVC" = no ; then - as_fn_error "could not find jsvc" "$LINENO" 5 -fi - -# Checks for libraries. - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcrypto" >&5 -$as_echo_n "checking for main in -lcrypto... " >&6; } -if test "${ac_cv_lib_crypto_main+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcrypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int -main () -{ -return main (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_crypto_main=yes -else - ac_cv_lib_crypto_main=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_main" >&5 -$as_echo "$ac_cv_lib_crypto_main" >&6; } -if test "x$ac_cv_lib_crypto_main" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBCRYPTO 1 -_ACEOF - - LIBS="-lcrypto $LIBS" - -else - as_fn_error "\"could not find SSL development libraries\"" "$LINENO" 5 -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lncurses" >&5 -$as_echo_n "checking for main in -lncurses... " >&6; } -if test "${ac_cv_lib_ncurses_main+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncurses $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int -main () -{ -return main (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ncurses_main=yes -else - ac_cv_lib_ncurses_main=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_main" >&5 -$as_echo "$ac_cv_lib_ncurses_main" >&6; } -if test "x$ac_cv_lib_ncurses_main" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBNCURSES 1 -_ACEOF - - LIBS="-lncurses $LIBS" - -else - as_fn_error "\"could not find ncurses libraries\"" "$LINENO" 5 -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpthread" >&5 -$as_echo_n "checking for main in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_main+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int -main () -{ -return main (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_main=yes -else - ac_cv_lib_pthread_main=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_main" >&5 -$as_echo "$ac_cv_lib_pthread_main" >&6; } -if test "x$ac_cv_lib_pthread_main" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBPTHREAD 1 -_ACEOF - - LIBS="-lpthread $LIBS" - -else - as_fn_error "\"could not find pthread libraries\"" "$LINENO" 5 -fi - - -# Checks for header files. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <ac_nonexistent.h> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <ac_nonexistent.h> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <string.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdlib.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <ctype.h> -#include <stdlib.h> -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in arpa/inet.h fcntl.h inttypes.h mntent.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/statvfs.h sys/time.h syslog.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# Checks for archtecture. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <sys/types.h> - #include <sys/param.h> - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <sys/types.h> - #include <sys/param.h> - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <limits.h> - -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <limits.h> - -int -main () -{ -#ifndef _BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; - -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - as_fn_error "\"big endian architecture is not supported\"" "$LINENO" 5;; #( - no) - ;; #( - universal) - -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h - - ;; #( - *) - as_fn_error "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; - esac - - -# Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if test "${ac_cv_c_inline+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - -ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" -case $ac_cv_c_int32_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int32_t $ac_cv_c_int32_t -_ACEOF -;; -esac - -ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" -case $ac_cv_c_int64_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int64_t $ac_cv_c_int64_t -_ACEOF -;; -esac - -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = x""yes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = x""yes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - -ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" -case $ac_cv_c_uint16_t in #( - no|yes) ;; #( - *) - - -cat >>confdefs.h <<_ACEOF -#define uint16_t $ac_cv_c_uint16_t -_ACEOF -;; - esac - -ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" -case $ac_cv_c_uint32_t in #( - no|yes) ;; #( - *) - -$as_echo "#define _UINT32_T 1" >>confdefs.h - - -cat >>confdefs.h <<_ACEOF -#define uint32_t $ac_cv_c_uint32_t -_ACEOF -;; - esac - -ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" -case $ac_cv_c_uint64_t in #( - no|yes) ;; #( - *) - -$as_echo "#define _UINT64_T 1" >>confdefs.h - - -cat >>confdefs.h <<_ACEOF -#define uint64_t $ac_cv_c_uint64_t -_ACEOF -;; - esac - -ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" -case $ac_cv_c_uint8_t in #( - no|yes) ;; #( - *) - -$as_echo "#define _UINT8_T 1" >>confdefs.h - - -cat >>confdefs.h <<_ACEOF -#define uint8_t $ac_cv_c_uint8_t -_ACEOF -;; - esac - - -# Checks for library functions. -for ac_header in vfork.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" -if test "x$ac_cv_header_vfork_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VFORK_H 1 -_ACEOF - -fi - -done - -for ac_func in fork vfork -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -if test "x$ac_cv_func_fork" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 -$as_echo_n "checking for working fork... " >&6; } -if test "${ac_cv_func_fork_works+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_fork_works=cross -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* By Ruediger Kuhlmann. */ - return fork () < 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_fork_works=yes -else - ac_cv_func_fork_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 -$as_echo "$ac_cv_func_fork_works" >&6; } - -else - ac_cv_func_fork_works=$ac_cv_func_fork -fi -if test "x$ac_cv_func_fork_works" = xcross; then - case $host in - *-*-amigaos* | *-*-msdosdjgpp*) - # Override, as these systems have only a dummy fork() stub - ac_cv_func_fork_works=no - ;; - *) - ac_cv_func_fork_works=yes - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 -$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} -fi -ac_cv_func_vfork_works=$ac_cv_func_vfork -if test "x$ac_cv_func_vfork" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 -$as_echo_n "checking for working vfork... " >&6; } -if test "${ac_cv_func_vfork_works+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_vfork_works=cross -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Thanks to Paul Eggert for this test. */ -$ac_includes_default -#include <sys/wait.h> -#ifdef HAVE_VFORK_H -# include <vfork.h> -#endif -/* On some sparc systems, changes by the child to local and incoming - argument registers are propagated back to the parent. The compiler - is told about this with #include <vfork.h>, but some compilers - (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a - static variable whose address is put into a register that is - clobbered by the vfork. */ -static void -#ifdef __cplusplus -sparc_address_test (int arg) -# else -sparc_address_test (arg) int arg; -#endif -{ - static pid_t child; - if (!child) { - child = vfork (); - if (child < 0) { - perror ("vfork"); - _exit(2); - } - if (!child) { - arg = getpid(); - write(-1, "", 0); - _exit (arg); - } - } -} - -int -main () -{ - pid_t parent = getpid (); - pid_t child; - - sparc_address_test (0); - - child = vfork (); - - if (child == 0) { - /* Here is another test for sparc vfork register problems. This - test uses lots of local variables, at least as many local - variables as main has allocated so far including compiler - temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris - 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should - reuse the register of parent for one of the local variables, - since it will think that parent can't possibly be used any more - in this routine. Assigning to the local variable will thus - munge parent in the parent process. */ - pid_t - p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), - p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); - /* Convince the compiler that p..p7 are live; otherwise, it might - use the same hardware register for all 8 local variables. */ - if (p != p1 || p != p2 || p != p3 || p != p4 - || p != p5 || p != p6 || p != p7) - _exit(1); - - /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent - from child file descriptors. If the child closes a descriptor - before it execs or exits, this munges the parent's descriptor - as well. Test for this by closing stdout in the child. */ - _exit(close(fileno(stdout)) != 0); - } else { - int status; - struct stat st; - - while (wait(&status) != child) - ; - return ( - /* Was there some problem with vforking? */ - child < 0 - - /* Did the child fail? (This shouldn't happen.) */ - || status - - /* Did the vfork/compiler bug occur? */ - || parent != getpid() - - /* Did the file descriptor bug occur? */ - || fstat(fileno(stdout), &st) != 0 - ); - } -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_vfork_works=yes -else - ac_cv_func_vfork_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 -$as_echo "$ac_cv_func_vfork_works" >&6; } - -fi; -if test "x$ac_cv_func_fork_works" = xcross; then - ac_cv_func_vfork_works=$ac_cv_func_vfork - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 -$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} -fi - -if test "x$ac_cv_func_vfork_works" = xyes; then - -$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h - -else - -$as_echo "#define vfork fork" >>confdefs.h - -fi -if test "x$ac_cv_func_fork_works" = xyes; then - -$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h - -fi - -# getmntent is in the standard C library on UNICOS, in -lsun on Irix 4, -# -lseq on Dynix/PTX, -lgen on Unixware. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getmntent" >&5 -$as_echo_n "checking for library containing getmntent... " >&6; } -if test "${ac_cv_search_getmntent+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char getmntent (); -int -main () -{ -return getmntent (); - ; - return 0; -} -_ACEOF -for ac_lib in '' sun seq gen; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_getmntent=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_getmntent+set}" = set; then : - break -fi -done -if test "${ac_cv_search_getmntent+set}" = set; then : - -else - ac_cv_search_getmntent=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getmntent" >&5 -$as_echo "$ac_cv_search_getmntent" >&6; } -ac_res=$ac_cv_search_getmntent -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - ac_cv_func_getmntent=yes - -$as_echo "#define HAVE_GETMNTENT 1" >>confdefs.h - -else - ac_cv_func_getmntent=no -fi - - -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_malloc_0_nonnull=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include <stdlib.h> -#else -char *malloc (); -#endif - -int -main () -{ -return ! malloc (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_malloc_0_nonnull=yes -else - ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then : - -$as_echo "#define HAVE_MALLOC 1" >>confdefs.h - -else - $as_echo "#define HAVE_MALLOC 0" >>confdefs.h - - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; -esac - - -$as_echo "#define malloc rpl_malloc" >>confdefs.h - -fi - - -for ac_func in dup2 ftruncate getmntent localtime_r memset mkdir socket strcasecmp strchr strdup strerror strtoul -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -ac_config_files="$ac_config_files Makefile dog/Makefile lib/Makefile sheep/Makefile shepherd/Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - - -: ${CONFIG_STATUS=./config.status} -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. -as_fn_error () -{ - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi - $as_echo "$as_me: error: $1" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.64. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.64, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2009 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "dog/Makefile") CONFIG_FILES="$CONFIG_FILES dog/Makefile" ;; - "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; - "sheep/Makefile") CONFIG_FILES="$CONFIG_FILES sheep/Makefile" ;; - "shepherd/Makefile") CONFIG_FILES="$CONFIG_FILES shepherd/Makefile" ;; - - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\).*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\).*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' <conf$$subs.awk | sed ' -/^[^""]/{ - N - s/\n// -} -' >>$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; - esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - ;; - - - - esac - -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/configure.in b/configure.in index 47de86d..bfc8d70 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,6 @@ AC_CONFIG_SRCDIR([lib/net.c]) # Checks for programs. AC_PROG_CC -AC_PROG_INSTALL AC_PROG_MAKE_SET # Checks for libraries. diff --git a/dog/Makefile.in b/dog/Makefile.in deleted file mode 100644 index ab28783..0000000 --- a/dog/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ - -ANT = env JAVA_HOME=@JAVA_HOME@ JAVA_LIB=@JAVA_LIB@ ant - -.PHONY:all -all: - @$(ANT) - -.PHONY:clean -clean: - @$(ANT) clean - -.PHONY:install -install: - @$(ANT) -Dinstall.dir=$(bindir) install diff --git a/dog/build.xml b/dog/build.xml deleted file mode 100644 index bd500db..0000000 --- a/dog/build.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0"?> - -<project name="dog" default="jar" basedir="."> - <property environment="env" /> - <property name="src.dir" location="src"/> - <property name="conf.dir" location="conf"/> - <property name="build.dir" location="build"/> - <property name="install.dir" location="/usr/local/bin"/> - <property name="jar.file" location="dog.jar"/> - <property name="bin.file" location="dog"/> - <property name="doc.dir" location="doc"/> - - <path id="dog.classpath"> - <pathelement location="."/> - <pathelement location="${env.JAVA_LIB}/commons-daemon.jar"/> - <pathelement location="${env.JAVA_LIB}/commons-cli.jar"/> - <pathelement location="${env.JAVA_LIB}/commons-logging.jar"/> - <pathelement location="${env.JAVA_LIB}/jgroups-all.jar"/> - <pathelement location="${env.JAVA_LIB}/log4j-1.2.jar"/> - </path> - - <target name="init"> - <tstamp/> - <mkdir dir="${build.dir}"/> - </target> - - <target name="compile" depends="init" description="compile the source"> - <copy todir="${build.dir}"> - <fileset dir="${conf.dir}" includes="*.xml"/> - </copy> - <copy file="${conf.dir}/manifest.in" tofile="${conf.dir}/manifest.mf" /> - <replace file="${conf.dir}/manifest.mf" token="@JAVA_LIB@" value="${env.JAVA_LIB}" /> - <copy file="${bin.file}.in" tofile="${bin.file}" /> - <replace file="${bin.file}" token="@JAVA_HOME@" value="${env.JAVA_HOME}" /> - <chmod file="${bin.file}" perm="755" /> - <javac srcdir="${src.dir}" destdir="${build.dir}" debug="true" source="6" - classpathref="dog.classpath"> - <compilerarg value="-Xlint"/> - </javac> - </target> - - <target name="jar" depends="compile" description="generate the jar file"> - <jar jarfile="${jar.file}" basedir="${build.dir}" - manifest="${conf.dir}/manifest.mf"/> - </target> - - <target name="javadoc"> - <delete dir="${doc.dir}" /> - <mkdir dir="${doc.dir}" /> - <javadoc sourcepath="${src.dir}" packagenames="net.osrg.sheepdog.*" destdir="${doc.dir}" - classpathref="dog.classpath" /> - </target> - - <target name="clean" description="clean up"> - <delete dir="${build.dir}"/> - <delete dir="${doc.dir}"/> - <delete file="${conf.dir}/manifest.mf"/> - <delete file="${bin.file}"/> - <delete file="${jar.file}"/> - </target> - - <target name="install" depends="jar" description="install the program"> - <echo message="install ${bin.file} ${install.dir}" /> - <exec executable="install"> - <arg value="${bin.file}" /> - <arg value="${install.dir}" /> - </exec> - <copy file="${jar.file}" todir="${install.dir}" preservelastmodified="true" overwrite="true" /> - </target> -</project> diff --git a/dog/conf/log4j.xml b/dog/conf/log4j.xml deleted file mode 100644 index 933932f..0000000 --- a/dog/conf/log4j.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - - <appender name="stdout" class="org.apache.log4j.ConsoleAppender"> - <layout class="org.apache.log4j.SimpleLayout" /> - </appender> - - <appender name="syslog" class="org.apache.log4j.net.SyslogAppender"> - <param name="SyslogHost" value="localhost" /> - <param name="Header" value="true" /> - <layout class="org.apache.log4j.SimpleLayout" /> - </appender> - - <category name="sheepdog" > - <priority value ="info" /> - <appender-ref ref="stdout" /> - <appender-ref ref="syslog" /> - </category> - -</log4j:configuration> diff --git a/dog/conf/manifest.in b/dog/conf/manifest.in deleted file mode 100644 index ffc1e09..0000000 --- a/dog/conf/manifest.in +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: net.osrg.sheepdog.Sheepdog -Class-Path: @JAVA_LIB@/jgroups-all.jar @JAVA_LIB@/commons-logging.jar @JAVA_LIB@/log4j-1.2.jar @JAVA_LIB@/commons-cli.jar @JAVA_LIB@/commons-daemon.jar diff --git a/dog/conf/sd.xml b/dog/conf/sd.xml deleted file mode 100644 index e69559a..0000000 --- a/dog/conf/sd.xml +++ /dev/null @@ -1,37 +0,0 @@ -<config> - <UDP - mcast_port="45566" - mcast_addr="228.10.10.10" - tos="16" - loopback="false" - discard_incompatible_packets="true" - max_bundle_size="64000" - max_bundle_timeout="30" - use_incoming_packet_handler="true" - ip_ttl="2" - enable_bundling="true"/> - <PING timeout="2000" - num_initial_members="3"/> - <MERGE2 max_interval="10000" - min_interval="5000"/> - <FD_SOCK/> - <FD timeout="10000" max_tries="5" shun="true"/> - <VERIFY_SUSPECT timeout="1500" /> - <BARRIER /> - <pbcast.NAKACK - use_mcast_xmit="false" gc_lag="0" - retransmit_timeout="300,600,1200,2400,4800" - discard_delivered_msgs="true"/> - <UNICAST timeout="300,600,1200,2400,3600"/> - <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" - max_bytes="400000"/> - <VIEW_SYNC avg_send_interval="60000" /> - <pbcast.GMS print_local_addr="true" join_timeout="30000" - shun="false" - view_bundling="true"/> - <SEQUENCER/> - <FC max_credits="2000000" - min_threshold="0.10"/> - <FRAG2 frag_size="60000"/> - <pbcast.STATE_TRANSFER /> -</config> diff --git a/dog/dog.in b/dog/dog.in deleted file mode 100644 index 1b8c74f..0000000 --- a/dog/dog.in +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -JAVA_HOME=@JAVA_HOME@ - -dog=`readlink -mn $0` -jarfile=`dirname $dog`/dog.jar -port=7000 -foreground=0 - -arg=$* - -while [ "$1" != "" ] -do - if [ $1 = "-f" -o $1 = "--foreground" ] - then - foreground=1 - fi - if [ $1 = "-p" -o $1 = "--dport" ] - then - shift - port=$1 - fi - shift -done - -if [ $foreground -gt 0 ] -then - java -jar $jarfile $arg -else - logfile=/tmp/sheepdog-$port - jsvc -home $JAVA_HOME -wait 10000 -outfile $logfile.out -errfile $logfile.err -pidfile $logfile.pid -user `whoami` -cp $jarfile net.osrg.sheepdog.Sheepdog $arg - if [ $? != 0 ] - then - # show error messages - java -jar $jarfile $arg - fi -fi diff --git a/dog/src/net/osrg/sheepdog/ClusterInformation.java b/dog/src/net/osrg/sheepdog/ClusterInformation.java deleted file mode 100644 index d81d78b..0000000 --- a/dog/src/net/osrg/sheepdog/ClusterInformation.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeSet; -import java.util.Map.Entry; - -public class ClusterInformation implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -5465560224627172616L; - public NodeList nodeList; - private Map<String, Node> locktbl; - private boolean complete; - private Node thisNode; - private boolean initialized; - private boolean shutdown; - - public boolean isComplete() { - return complete; - } - - public void setComplete(boolean complete) { - Log.debug("set complete"); - this.complete = complete; - } - - public ClusterInformation(Node thisNode, boolean logging) { - nodeList = new NodeList(); - locktbl = new HashMap<String, Node>(); - complete = false; - setInitialized(false); - startupNodeList = null; - this.thisNode = thisNode; - this.shutdown = false; - } - - public int lock(String vdiname, Node node) throws Exception { - if (locktbl.containsKey(vdiname) && locktbl.get(vdiname) != null) { - // TODO throw Exception when locking is failed - return -1; - } - locktbl.put(vdiname, node); - return 0; - } - - public int unlock(String vdiname) throws Exception { - if (!locktbl.containsKey(vdiname) || locktbl.get(vdiname) == null) { - // TODO throw Exception when locking is failed - return -1; - } - locktbl.put(vdiname, null); - return 0; - } - - public void join(Node node) { - nodeList.add(node); - } - - public void leave(Node node) { - nodeList.remove(node); - } - - public void merge(ClusterInformation ci) { - if (!ci.isComplete()) { - Log.error("unexpected error"); - return; - } - - setInitialized(ci.isInitialized()); - locktbl = ci.getLockTable(); - nodeList = ci.nodeList; - complete = true; - } - - - public Map<String, Node> getLockTable() { - return locktbl; - } - - public NodeList getNodeList() { - if (isInitialized()) { - return nodeList; - } else { - TreeSet<Node> set = new TreeSet<Node>(); - set.add(thisNode); - NodeList nl = new NodeList(0, set); - return nl; - } - } - - public ByteBuffer encodeLockTbl() { - ByteBuffer buf = ByteBuffer.allocate(lockTblSize()); - buf.order(ByteOrder.LITTLE_ENDIAN); - - for (Entry<String, Node> ent : locktbl.entrySet()) { - String name = ent.getKey(); - Node node = ent.getValue(); - if (node == null) { - continue; - } - for (int i = 0; i < 32; i++) { - if (i < name.length()) { - buf.put((byte) name.charAt(i)); - } else { - buf.put((byte) 0); - } - } - buf.put(node.toBuffer()); - for (int i = 0; i < 4; i++) { - buf.put((byte) 0); // padding - } - } - buf.flip(); - return buf; - } - - public int lockTblSize() { - return 56 * locktbl.size(); - } - - public boolean isInitialized() { - return initialized; - } - - public void addStartupNodeList(NodeList nl, long ctime) { - startupNodeList = nl; - this.ctime = ctime; - } - - private NodeList startupNodeList; - private long ctime; - - public NodeList getStartupNodeList() { - return startupNodeList; - } - - public void setInitialized(boolean initialized) { - this.initialized = initialized; - } - - public void setShutdown(boolean shutdown) { - this.shutdown = shutdown; - } - - public boolean isShutdown() { - return shutdown; - } - - public void setCtime(long ctime) { - this.ctime = ctime; - } - - public long getCtime() { - return ctime; - } -} diff --git a/dog/src/net/osrg/sheepdog/Connection.java b/dog/src/net/osrg/sheepdog/Connection.java deleted file mode 100644 index 6d44a40..0000000 --- a/dog/src/net/osrg/sheepdog/Connection.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.channels.ReadableByteChannel; -import java.nio.channels.SelectionKey; -import java.nio.channels.SocketChannel; - -import net.osrg.sheepdog.headers.Request; -import net.osrg.sheepdog.headers.Response; - -public class Connection { - - private SelectionKey key; - private STATE rxState; - private Request request; - private ByteBuffer rxHeader; - private ByteBuffer rxData; - private STATE txState; - private Response response; - private ByteBuffer txHeader; - private ByteBuffer txData; - private ConnectionCallback callback; - - private int uid; - - enum STATE { - IO_HEADER, IO_DATA, IO_END, IO_CLOSE - } - - public Connection(SelectionKey k, int u, ConnectionCallback f) { - key = k; - uid = u; - callback = f; - request = null; - response = null; - rxState = STATE.IO_HEADER; - rxHeader = ByteBuffer.allocate(Request.HEADER_SIZE); - rxHeader.order(ByteOrder.LITTLE_ENDIAN); - rxData = null; - txState = STATE.IO_HEADER; - response = null; - txHeader = null; - txData = null; - } - - public void setRxOff() { - int ops = key.interestOps(); - key.interestOps(ops & ~SelectionKey.OP_READ); - } - - public void setRxOn() { - rxState = STATE.IO_HEADER; - rxHeader = ByteBuffer.allocate(Request.HEADER_SIZE); - rxHeader.order(ByteOrder.LITTLE_ENDIAN); - rxData = null; - - int ops = key.interestOps(); - key.interestOps(ops | SelectionKey.OP_READ); - } - - public void setTxOff() { - int ops = key.interestOps(); - key.interestOps(ops & ~SelectionKey.OP_WRITE); - } - - public void setTxOn(ByteBuffer data) { - setTxOn(OpCode.OP_UNKNOWN, data); - } - - public void setTxOn(OpCode opcode, ByteBuffer data) { - setTxOn(new Response(request, opcode.getValue(), data, 0)); - } - - public void setTxOn(Response resp) { - txState = STATE.IO_HEADER; - this.response = resp; - txHeader = resp.getHeader(); - txData = resp.getData(); - - int ops = key.interestOps(); - key.interestOps(ops | SelectionKey.OP_WRITE); - } - - public boolean isConnDead() { - return rxState == STATE.IO_CLOSE || txState == STATE.IO_CLOSE; - } - - private void rx(ByteBuffer buf, STATE nextState) throws IOException { - ReadableByteChannel sc = (ReadableByteChannel) key.channel(); - if (sc.read(buf) == -1) { - Log.debug("The channel has reached end-of-stream. "); - // TODO remove from HashMap - throw new IOException("The channel has reached end-of-stream. "); - } - if (!buf.hasRemaining()) { - rxState = nextState; - } - } - - private void tx(ByteBuffer buf, STATE nextState) throws IOException { - SocketChannel sc = (SocketChannel) key.channel(); - sc.write(buf); - if (!buf.hasRemaining()) { - txState = nextState; - } - } - - public void rxHandler() { - try { - switch (rxState) { - case IO_HEADER: - rx(rxHeader, STATE.IO_DATA); - if (rxHeader.hasRemaining()) { - break; - } - rxHeader.position(0); - request = new Request(rxHeader); - if (request.getDataLength() == 0 || request.getFlags() != 1) { - rxState = STATE.IO_END; - break; - } - rxData = ByteBuffer.allocate(request.getDataLength()); - rxData.order(ByteOrder.LITTLE_ENDIAN); - break; - case IO_DATA: - rx(rxData, STATE.IO_END); - break; - default: - Log.error("BUG: unknown state " + rxState); - break; - } - } catch (IOException e) { - rxState = STATE.IO_CLOSE; - } - - try { - if (rxState == STATE.IO_END) { - if (request.getDataLength() != 0 && request.getFlags() == 1) { - rxData.position(0); - request.setData(rxData); - } - setRxOff(); - callback.rxDone(key, request.getOpcode(), request, uid); - } else if (rxState == STATE.IO_CLOSE) { - key.channel().close(); - key.cancel(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - public void txHandler() { - try { - switch (txState) { - case IO_HEADER: - tx(txHeader, STATE.IO_DATA); - if (txHeader.hasRemaining()) { - break; - } - txHeader.position(0); - if (response.getDataLength() == 0) { - txState = STATE.IO_END; - break; - } - break; - case IO_DATA: - tx(txData, STATE.IO_END); - break; - default: - Log.error("BUG: unknown state " + txState); - break; - } - } catch (IOException e) { - txState = STATE.IO_CLOSE; - } - try { - if (txState == STATE.IO_END) { - setTxOff(); - setRxOn(); - } else if (txState == STATE.IO_CLOSE) { - key.channel().close(); - key.cancel(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/dog/src/net/osrg/sheepdog/ConnectionCallback.java b/dog/src/net/osrg/sheepdog/ConnectionCallback.java deleted file mode 100644 index f9116d0..0000000 --- a/dog/src/net/osrg/sheepdog/ConnectionCallback.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.io.IOException; -import java.nio.channels.SelectionKey; - -import net.osrg.sheepdog.headers.Request; - -public interface ConnectionCallback { - void rxDone(SelectionKey key, OpCode op, Request req, int uid) - throws IOException; -} diff --git a/dog/src/net/osrg/sheepdog/DirEntry.java b/dog/src/net/osrg/sheepdog/DirEntry.java deleted file mode 100644 index 5ccf3de..0000000 --- a/dog/src/net/osrg/sheepdog/DirEntry.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -public class DirEntry { - - private static final int DIR_ALIGN = 8; - - public DirEntry(long oid, int tag, byte flags, String name - , int epoch) { - this.oid = oid; - this.tag = tag; - this.flags = flags; - this.epoch = epoch; - this.padding = 0; - this.name = name; - this.nameLen = (short) name.length(); - } - - public DirEntry(ByteBuffer buf) { - oid = buf.getLong(); - tag = buf.getInt(); - nameLen = buf.getShort(); - type = buf.get(); - flags = buf.get(); - epoch = buf.getInt(); - padding = buf.getInt(); - int len = roundup(nameLen, DIR_ALIGN); - byte[] bs = new byte[nameLen]; - for (int i = 0; i < len; i++) { - if (i < bs.length) { - bs[i] = buf.get(); - } else { - buf.get(); - } - } - name = new String(bs); - } - - public ByteBuffer toBuffer() { - ByteBuffer buf = ByteBuffer.allocate(1024 * 1024); // TODO support larger size - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.putLong(oid); - buf.putInt(tag); - buf.putShort(nameLen); - buf.put(type); - buf.put(flags); - buf.putInt(epoch); - buf.putInt(padding); - int len = roundup(nameLen, DIR_ALIGN); - byte[] bs = name.getBytes(); - for (int i = 0; i < len; i++) { - if (i < bs.length) { - buf.put(bs[i]); - } else { - buf.put((byte) 0); - } - } - buf.flip(); - return buf; - } - - private static int roundup(int x, int y) { - return ((((x) + ((y) - 1)) / (y)) * (y)); - } - - public long getOid() { - return oid; - } - - public int getTag() { - return tag; - } - - public short getNameLen() { - return nameLen; - } - - public byte getType() { - return type; - } - - public byte getFlags() { - return flags; - } - - public void setFlags(byte flags) { - this.flags = flags; - } - - public void setEpoch(int epoch) { - this.epoch = epoch; - } - - public int getEpoch() { - return epoch; - } - - public String getName() { - return name; - } - - private long oid; - private int tag; - private short nameLen; - private byte type; - private byte flags; - private int epoch; - private int padding; - private String name; -} diff --git a/dog/src/net/osrg/sheepdog/Inode.java b/dog/src/net/osrg/sheepdog/Inode.java deleted file mode 100644 index 9ff4946..0000000 --- a/dog/src/net/osrg/sheepdog/Inode.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -public class Inode { - - static final int MAX_CHILDREN = 1024; - static final int MAX_DATA_OBJS = (1 << 18); - static final int DATA_OBJ_SIZE = (1 << 22); - static final int SIZE = 48 + 8 * MAX_CHILDREN + 8 * MAX_DATA_OBJS + 4 - * MAX_DATA_OBJS; - - public Inode(int copies, long oid, long size, long baseOid) { - this.oid = oid; - this.vdiSize = size; - this.blockSize = DATA_OBJ_SIZE; - long tm = System.currentTimeMillis(); - this.ctime = ((tm / 1000) << 32) | ((tm % 1000) * 1000000); - this.nrCopies = copies; - this.parentOid = baseOid; - childOid = new long[MAX_CHILDREN]; - dataOid = new long[MAX_DATA_OBJS]; - epoch = new int[MAX_DATA_OBJS]; - } - - public Inode(ByteBuffer buf) { - oid = buf.getLong(); - ctime = buf.getLong(); - vdiSize = buf.getLong(); - blockSize = buf.getLong(); - copyPolicy = buf.getInt(); - nrCopies = buf.getInt(); - parentOid = buf.getLong(); - childOid = new long[MAX_CHILDREN]; - for (int i = 0; i < childOid.length; i++) { - childOid[i] = buf.getLong(); - } - dataOid = new long[MAX_DATA_OBJS]; - for (int i = 0; i < dataOid.length; i++) { - dataOid[i] = buf.getLong(); - } - epoch = new int[MAX_DATA_OBJS]; - for (int i = 0; i < epoch.length; i++) { - epoch[i] = buf.getInt(); - } - } - - public ByteBuffer toBuffer() { - ByteBuffer buf = ByteBuffer.allocate(SIZE); - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.putLong(oid); - buf.putLong(ctime); - buf.putLong(vdiSize); - buf.putLong(blockSize); - buf.putInt(copyPolicy); - buf.putInt(nrCopies); - buf.putLong(parentOid); - for (int i = 0; i < childOid.length; i++) { - buf.putLong(childOid[i]); - } - for (int i = 0; i < dataOid.length; i++) { - buf.putLong(dataOid[i]); - } - for (int i = 0; i < epoch.length; i++) { - buf.putInt(epoch[i]); - } - buf.flip(); - return buf; - } - - public static int getMaxChildren() { - return MAX_CHILDREN; - } - - public static int getMaxDataObjs() { - return MAX_DATA_OBJS; - } - - public long getOid() { - return oid; - } - - public long getCtime() { - return ctime; - } - - public long getVdiSize() { - return vdiSize; - } - - public long getBlockSize() { - return blockSize; - } - - public int getCopyPolicy() { - return copyPolicy; - } - - public int getNrCopies() { - return nrCopies; - } - - public long getParentOid() { - return parentOid; - } - - public long[] getChildOid() { - return childOid; - } - - public long[] getDataOid() { - return dataOid; - } - - public void setEpoch(int[] epoch) { - this.epoch = epoch; - } - - public int[] getEpoch() { - return epoch; - } - - private long oid; - private long ctime; - private long vdiSize; - private long blockSize; - private int copyPolicy; - private int nrCopies; - private long parentOid; - private long[] childOid; - private long[] dataOid; - private int[] epoch; -} diff --git a/dog/src/net/osrg/sheepdog/Log.java b/dog/src/net/osrg/sheepdog/Log.java deleted file mode 100644 index f52996a..0000000 --- a/dog/src/net/osrg/sheepdog/Log.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.log4j.net.SyslogAppender; - -public final class Log { - private static Logger logger = Logger.getLogger("sheepdog"); - - private Log() { - } - - public static Logger getLogger() { - return logger; - } - - public static void setLevel(Level level) { - logger.setLevel(Level.DEBUG); - } - - private static String format(Object obj) { - if (obj == null) { - obj = "null"; - } - StackTraceElement[] stack = (new Throwable()).getStackTrace(); - String str = obj.toString(); - String thisFile = stack[0].getFileName(); - for (int i = 0; i < stack.length; i++) { - StackTraceElement frame = stack[i]; - if (!frame.getFileName().equals(thisFile)) { - return "(" + frame.getFileName() + ":" + frame.getLineNumber() - + ") " + str; - } - } - return str; - } - - public static void debug(Object obj) { - if (!logger.isDebugEnabled()) { - return; - } - logger.debug(format(obj)); - } - - public static void debug(Object obj, java.lang.Throwable t) { - if (!logger.isDebugEnabled()) { - return; - } - logger.debug(format(obj), t); - } - - public static void error(Object obj) { - logger.error(format(obj)); - } - - public static void error(Object obj, java.lang.Throwable t) { - logger.error(format(obj), t); - } - - public static void useSyslog(String syslogHost) { - SyslogAppender appender = (SyslogAppender) logger.getAppender("syslog"); - appender.setSyslogHost(syslogHost); - logger.removeAppender("stdout"); - } - - public static void useStdout() { - logger.removeAppender("syslog"); - } -} diff --git a/dog/src/net/osrg/sheepdog/Master.java b/dog/src/net/osrg/sheepdog/Master.java deleted file mode 100644 index c03f46b..0000000 --- a/dog/src/net/osrg/sheepdog/Master.java +++ /dev/null @@ -1,325 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.nio.channels.Channel; -import java.nio.channels.SelectionKey; -import java.nio.channels.Selector; -import java.nio.channels.SocketChannel; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -import net.osrg.sheepdog.headers.Request; -import net.osrg.sheepdog.headers.Response; -import net.osrg.sheepdog.messages.SheepdogMessage; -import net.osrg.sheepdog.messages.LeaveMessage; - -public class Master implements Runnable, ConnectionCallback { - - private Node thisNode; - private Selector selector; - private boolean isMaster; - private NodeList nodeList; - // TODO too many HashMap - private Map<Node, SelectionKey> connectedMap; - private Map<Node, Integer> keepAliveMap; - private Map<SelectionKey, Node> rconnectedMap; - private Set<SelectionKey> ackedMap; - private Map<SelectionKey, Connection> connMap; - private int epoch; - private boolean epochUpdated; - private Sheepdog sd; - private Lock lock; - private Condition notMaster; - private int nrSubmasters; - private boolean shutdown; - - public static final int KEEPCNT = 15; - public static final int KEEPIDLE = 1000; - - public void start(NodeList nl, int nrSubmasters, boolean shutdown) { - this.nrSubmasters = nrSubmasters; - this.shutdown = shutdown; - lock.lock(); - try { - Log.debug(nl); - nodeList = nl; - if (!isMaster) { - isMaster = true; - try { - selector = Selector.open(); - } catch (IOException e) { - e.printStackTrace(); - } - notMaster.signal(); - } - } finally { - lock.unlock(); - } - } - - public void stop() { - lock.lock(); - try { - isMaster = false; - } finally { - lock.unlock(); - } - } - - public Master(Node thisNode, Sheepdog s) { - this.thisNode = thisNode; - sd = s; - epoch = -1; - epochUpdated = false; - nodeList = new NodeList(); - connectedMap = new HashMap<Node, SelectionKey>(); - keepAliveMap = new HashMap<Node, Integer>(); - rconnectedMap = new HashMap<SelectionKey, Node>(); - connMap = new HashMap<SelectionKey, Connection>(); - ackedMap = new HashSet<SelectionKey>(); - isMaster = false; - selector = null; - lock = new ReentrantLock(); - notMaster = lock.newCondition(); - this.nrSubmasters = 0; - this.shutdown = false; - } - - private void leave(Node host) { - Log.debug(host); - - SheepdogMessage sm = new LeaveMessage(thisNode, 0, host); - sd.addMessage(sm); - } - - private void timeout() { - // timeout - nodeList.setMasterNode(thisNode); - if (epoch < nodeList.getEpoch()) { - epoch = nodeList.getEpoch(); - epochUpdated = true; - Log.debug("epoch is updated. new epoch is " + epoch); - } else { - epochUpdated = false; - } - Set<Node> nodeSet = nodeList.getNodeSet(); - for (Node node : nodeSet) { - try { - if (connectedMap.get(node) != null) { - SelectionKey key = connectedMap.get(node); - if (connMap.get(key).isConnDead()) { - connectedMap.remove(node); - keepAliveMap.remove(node); - rconnectedMap.remove(key); - connMap.remove(key); - ackedMap.remove(key); - } else { - continue; - } - } - InetSocketAddress address; - address = new InetSocketAddress(node.getInetAddress(), node - .getDogPort()); - SocketChannel ch = SocketChannel.open(); - ch.configureBlocking(false); - ch.connect(address); - - SelectionKey key = ch.register(selector, - SelectionKey.OP_CONNECT); - connMap.put(key, new Connection(key, node.hashCode(), this)); - rconnectedMap.put(key, node); - } catch (Exception e) { - Log.error("Exception caught: " + e); - SelectionKey key = connectedMap.get(node); - connectedMap.remove(node); - keepAliveMap.remove(node); - rconnectedMap.remove(key); - connMap.remove(key); - ackedMap.remove(key); - continue; - } - } - - Iterator<Node> itr = connectedMap.keySet().iterator(); - while (itr.hasNext()) { - Node node = itr.next(); - SelectionKey key = connectedMap.get(node); - if (node != null && ackedMap.contains(key)) { - ackedMap.remove(key); // reset - Connection conn = connMap.get(key); - - Log.debug("send probe to " + rconnectedMap.get(key)); - - // TODO implement KeepAlive header class - if (epochUpdated) { - Response rsp = new Response(null, OpCode.OP_UPDATE_NODELIST - .getValue(), nodeList.toLogData(), 0); - rsp.setId(nrSubmasters); - conn.setTxOn(rsp); - } else { - Response rsp = new Response(null, OpCode.OP_NOP.getValue(), null, 0); - if (shutdown) { - rsp.setId(1); - } else { - rsp.setId(0); - } - conn.setTxOn(rsp); - } - keepAliveMap.put(node, 0); - continue; - } - - keepAliveMap.put(node, keepAliveMap.get(node) + 1); - if (keepAliveMap.get(node) < KEEPCNT) { - Log.debug(node + " may down: " + keepAliveMap.get(node)); - continue; - } - Channel c = key.channel(); - try { - c.close(); - } catch (IOException e) { - Log.error("failed to close: ", e); - } - Log.debug("remove node"); - if (nodeSet.contains(node)) { - leave(node); - } - rconnectedMap.remove(key); - itr.remove(); - keepAliveMap.remove(node); - connMap.remove(key); - ackedMap.remove(key); - } - } - - private void stopMaster() { - try { - if (selector != null) { - Iterator<SelectionKey> itr = selector.keys().iterator(); - while (itr.hasNext()) { - SelectionKey key = itr.next(); - Channel c = key.channel(); - Log.debug("Closing " + c.toString()); - try { - c.close(); - } catch (IOException e) { - Log.error("failed to close: ", e); - } - Node node = rconnectedMap.remove(key); - Set<Node> nodeSet = nodeList.getNodeSet(); - if (nodeSet != null && nodeSet.contains(node)) { - leave(node); - } - connectedMap.remove(node); - keepAliveMap.remove(node); - connMap.remove(key); - ackedMap.remove(key); - } - selector.close(); - selector = null; - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void run() { - for (;;) { - try { - lock.lock(); - try { - while (!isMaster) { - stopMaster(); - notMaster.await(); - } - } finally { - lock.unlock(); - } - - while (selector.select(KEEPIDLE) > 0) { - // Get "selected" objects - Iterator<SelectionKey> itr = selector.selectedKeys() - .iterator(); - while (itr.hasNext()) { - SelectionKey key = itr.next(); - itr.remove(); - - if (!key.isValid()) { - continue; - } - - try { - if (key.isConnectable()) { - SocketChannel ch = (SocketChannel) key - .channel(); - ch.finishConnect(); - connectedMap.put(rconnectedMap.get(key), key); - keepAliveMap.put(rconnectedMap.get(key), 0); - ackedMap.add(key); - Log.debug("connected: " + rconnectedMap.get(key)); - - Connection conn = connMap.get(key); - - key.interestOps(0); // remove OP_CONNECT - Response rsp = new Response(null, OpCode.OP_UPDATE_NODELIST.getValue(), - nodeList.toLogData(), 0); - rsp.setId(nrSubmasters); - conn.setTxOn(rsp); - - Log.debug("send probe to " + rconnectedMap.get(key)); - } else if (key.isWritable()) { - connMap.get(key).txHandler(); - } else if (key.isReadable()) { - Log.debug("ack from " - + rconnectedMap.get(key)); - connMap.get(key).rxHandler(); - } - } catch (IOException e) { - Log.debug("remove node: " + e + " " + rconnectedMap.get(key)); - Node node = rconnectedMap.remove(key); - if (nodeList.getNodeSet().contains(node)) { - leave(node); - } - SocketChannel ch = (SocketChannel) key.channel(); - ch.close(); - connectedMap.remove(node); - keepAliveMap.remove(node); - rconnectedMap.remove(key); - connMap.remove(key); - ackedMap.remove(key); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - - timeout(); - } - } - - @Override - public void rxDone(SelectionKey key, OpCode op, Request req, int uid) - throws IOException { - ackedMap.add(key); - } -} diff --git a/dog/src/net/osrg/sheepdog/MasterGroup.java b/dog/src/net/osrg/sheepdog/MasterGroup.java deleted file mode 100644 index 5a109a0..0000000 --- a/dog/src/net/osrg/sheepdog/MasterGroup.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Vector; - -import net.osrg.sheepdog.headers.Response; -import net.osrg.sheepdog.messages.MasterChangedMessage; -import net.osrg.sheepdog.messages.SheepdogMessage; - -import org.jgroups.Address; -import org.jgroups.JChannel; -import org.jgroups.Message; -import org.jgroups.ReceiverAdapter; -import org.jgroups.View; - -public class MasterGroup extends ReceiverAdapter { - private Node thisNode; - private Sheepdog sd; - private JChannel jchannel; - private ClusterInformation ci; - private int nrSubmasters; - private Queue<SheepdogMessage> pendingMessages; - private Master master; - - public enum ROLE { - MASTER, SUBMASTER, SLAVE - }; - - private ROLE role = ROLE.SLAVE; - - public MasterGroup(Node thisNode, Master master, Sheepdog sd, JChannel jch) { - this.thisNode = thisNode; - pendingMessages = new LinkedList<SheepdogMessage>(); - this.sd = sd; - this.master = master; - jchannel = jch; - initialize(); - this.nrSubmasters = 0; - } - - public void initialize() { - role = ROLE.SLAVE; - ci = new ClusterInformation(thisNode, true); - } - - @Override - public synchronized void receive(Message msg) { - try { - SheepdogMessage sm = (SheepdogMessage) msg.getObject(); - Log.debug("receive start: class = " + sm.getClass().toString() - + ", isFlushed = " + sm.isFlushed()); - if (sm.isFlushed()) { - if (pendingMessages.peek() != null) { - if (pendingMessages.peek().getMessageId() == sm.getMessageId()) { - pendingMessages.remove(); - } - } - if (!ci.isShutdown()) { - sm.updateClusterInfo(ci); - } - if (role == ROLE.MASTER) { - master.start(ci.getNodeList(), nrSubmasters, ci.isShutdown()); - } - if (thisNode.equals(sm.getFrom())) { - Response rsp = sm.reply(ci); - if (rsp != null) { - sd.setResult(sm.getMessageId(), rsp); - } - sd.disconnectDone(role); - } - } else { - pendingMessages.add(sm); - if (role == ROLE.MASTER) { - if (!ci.isShutdown()) { - sm.updateSuperObject(ci); - } - sm.setFlushed(true); - sd.addMessage(sm); - } else if (thisNode.equals(sm.getFrom()) && sm instanceof MasterChangedMessage) { - role = ROLE.MASTER; - while (pendingMessages.peek() != null) { - SheepdogMessage pendingMsg = pendingMessages.poll(); - if (!ci.isShutdown()) { - pendingMsg.updateSuperObject(ci); - } - pendingMsg.setFlushed(true); - sd.addMessage(pendingMsg); - } - } - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - @Override - public void suspect(Address address) { - Log.debug("suspect: " + address); - } - - @Override - public void block() { - Log.debug("blocked"); - } - - @Override - public synchronized void viewAccepted(View view) { - Log.debug("new master groups: " + view.getMembers()); - Log.debug("local address: " + jchannel.getLocalAddress()); - - try { - Log.debug("viewAccepted: " + view); - Log.debug("mbrs: " + view.size()); - Address localAddr = jchannel.getLocalAddress(); - if (view.containsMember(localAddr)) { - Vector<Address> mbrs = view.getMembers(); - if (mbrs.get(0).equals(localAddr)) { - MasterChangedMessage msg = new MasterChangedMessage(thisNode, 0); - sd.addMessage(msg); - ci.setComplete(true); - Log.debug("role = MASTER. "); - nrSubmasters = view.size(); - master.start(ci.getNodeList(), nrSubmasters, ci.isShutdown()); - return; - } - List<Address> submasters = mbrs.subList(1, Math.min( - mbrs.size(), sd.getLimitMbrs())); - Log.debug("new submasters: " + submasters); - for (Address addr : submasters) { - if (addr.equals(localAddr)) { - role = ROLE.SUBMASTER; - Log.debug("role = SUBMASTER. "); - master.stop(); - return; - } - } - role = ROLE.SLAVE; - Log.debug("role = SLAVE. "); - master.stop(); - } - } catch (Exception e) { - // TODO define more suitable Exception (i.e. SheepdogException) - e.printStackTrace(); - } - } - -} diff --git a/dog/src/net/osrg/sheepdog/Node.java b/dog/src/net/osrg/sheepdog/Node.java deleted file mode 100644 index 261dced..0000000 --- a/dog/src/net/osrg/sheepdog/Node.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.io.Serializable; -import java.util.Arrays; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -public class Node implements Serializable, Comparable<Node> { - - /** - * - */ - public static final int NODE_SIZE = 20; - - private static final long serialVersionUID = 346960641984069648L; - private byte[] id; - private InetAddress address; - private int sheepPort; - private int dogPort; - - public Node(long oid) { - MessageDigest md; - try { - md = MessageDigest.getInstance("SHA1"); - ByteBuffer buf = ByteBuffer.allocate(8); - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.putLong(oid); - buf.flip(); - md.update(buf.array()); - this.id = md.digest(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - this.id = null; - } - } - - public Node(String h, int dPort, int sPort) throws UnknownHostException { - this(InetAddress.getByName(h), dPort, sPort); - } - - public Node(InetAddress address, int dPort, int sPort) { - this.address = address; - this.dogPort = dPort; - this.sheepPort = sPort; - try { - MessageDigest md = MessageDigest.getInstance("SHA1"); - md.update(address.getAddress()); - md.update((byte) dPort); - md.update((byte) (dPort >> 8)); - id = md.digest(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - id = null; - } - } - - public byte[] getId() { - return id; - } - - public InetAddress getInetAddress() { - return address; - } - - public int getDogPort() { - return dogPort; - } - - public int getSheepPort() { - return sheepPort; - } - - public ByteBuffer toBuffer() { - ByteBuffer buf = ByteBuffer.allocate(NODE_SIZE); - buf.order(ByteOrder.LITTLE_ENDIAN); - - byte[] addr = address.getAddress(); - if (addr.length == 4) { // IPv4 - for (int i = 0; i < 12; i++) { - buf.put((byte) 0); - } - buf.put(addr); - } else if (addr.length == 16) { // IPv6 - buf.put(addr); - } else { - Log.error("Unknown protocol"); - for (int i = 0; i < 16; i++) { - buf.put((byte) 0); - } - } - - buf.putShort((short) sheepPort); - buf.putShort((short) dogPort); - buf.flip(); - return buf; - } - - public static Node fromBuffer(ByteBuffer buf) { - try { - byte [] addr = new byte[16]; - buf.get(addr, 0, 12); - if (Arrays.equals(addr, new byte[16])) { - // IPv4 - addr = new byte[4]; - buf.get(addr); - } else { - // IPv6 - buf.get(addr, 12, 4); - } - InetAddress address = InetAddress.getByAddress(addr); - int sheepPort = buf.getShort(); - int dogPort = buf.getShort(); - return new Node(address, dogPort, sheepPort); - } catch (UnknownHostException e) { - e.printStackTrace(); - return null; - } - } - - @Override - public String toString() { - String hostname = address.getHostAddress(); - return hostname + ":" + dogPort + ":" + sheepPort; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof Node)) { - return false; - } - Node node = (Node) o; - if (node == null) { - return false; - } - return (compareTo(node) == 0); - } - - @Override - public int hashCode() { - if (id == null) { - return 0; - } - return id.hashCode(); - } - - @Override - public int compareTo(Node arg0) { - byte[] as = this.id; - byte[] bs = arg0.id; - - for (int i = 0; i < 20; i++) { - int a = as[i]; - int b = bs[i]; - if (a < 0) { - a += 256; - } - if (b < 0) { - b += 256; - } - if (a > b) { - return 1; - } else if (a < b) { - return -1; - } - } - return 0; - } -} diff --git a/dog/src/net/osrg/sheepdog/NodeList.java b/dog/src/net/osrg/sheepdog/NodeList.java deleted file mode 100644 index f96e8fb..0000000 --- a/dog/src/net/osrg/sheepdog/NodeList.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.Arrays; -import java.util.Set; -import java.util.TreeSet; - -public class NodeList implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -4381317706988377585L; - public static final int NODE_LIST_ENTRY_SIZE = 40; - - public void setMasterNode(Node node) { - masterIndex = getIndex(node); - } - - public void setMasterIndex(int masterIndex) { - this.masterIndex = masterIndex; - } - - private int masterIndex; - - public NodeList() { - this(0, new TreeSet<Node>()); - } - - @SuppressWarnings("unchecked") - public NodeList(int v, TreeSet<Node> set) { - masterIndex = -1; - epoch = v; - nodeSet = (TreeSet<Node>) set.clone(); - } - - public int countNode() { - return nodeSet.size(); - } - - public int getEpoch() { - return epoch; - } - - public void setEpoch(int epoch) { - this.epoch = epoch; - } - - public Set<Node> getNodeSet() { - return nodeSet; - } - - public int getMasterIndex() { - return masterIndex; - } - - public int getIndex(Node node) { - return Arrays.binarySearch(nodeSet.toArray(), node); - } - - public ByteBuffer toRspData() { - ByteBuffer buf = ByteBuffer - .allocate(NODE_LIST_ENTRY_SIZE * countNode()); - buf.order(ByteOrder.LITTLE_ENDIAN); - for (Node node : nodeSet) { - buf.put(Arrays.copyOf(node.getId(), 20)); - buf.put(node.toBuffer()); - } - buf.flip(); - return buf; - } - - public ByteBuffer toLogData() { - int nrNodes = nodeSet.size(); - ByteBuffer buf = ByteBuffer.allocate(16 + nrNodes * Node.NODE_SIZE); - buf.order(ByteOrder.LITTLE_ENDIAN); - - buf.putInt(epoch); - buf.putInt(nrNodes); - buf.putInt(masterIndex); - buf.putInt(0); - for (Node node : nodeSet) { - buf.put(node.toBuffer()); - } - buf.flip(); - return buf; - } - - public static NodeList fromLogData(ByteBuffer buf) { - int epoch = buf.getInt(); - int nrNodes = buf.getInt(); - int masterIndex = buf.getInt(); - buf.getInt(); - TreeSet<Node> nodeSet = new TreeSet<Node>(); - for (int i = 0; i < nrNodes; i++) { - ByteBuffer nodeBuf = ByteBuffer.allocate(Node.NODE_SIZE); - nodeBuf.order(ByteOrder.LITTLE_ENDIAN); - buf.get(nodeBuf.array()); - nodeSet.add(Node.fromBuffer(nodeBuf)); - } - NodeList nodeList = new NodeList(epoch, nodeSet); - nodeList.setMasterIndex(masterIndex); - return nodeList; - } - - @Override - public String toString() { - return "[epoch: " + epoch + ", map: " + nodeSet + "]"; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof NodeList)) { - return false; - } - NodeList nl = (NodeList) o; - if (nl == null) { - return false; - } - if (this.epoch != nl.epoch) { - return false; - } - return this.nodeSet.equals(nl.nodeSet); - } - - @Override - public int hashCode() { - return nodeSet.hashCode() + epoch; - } - - public boolean containsAll(NodeList nl) { - if (nl == null) { - return false; - } - for (Node node : nl.getNodeSet()) { - if (!this.nodeSet.contains(node)) { - return false; - } - } - return true; - } - - public boolean add(Node node) { - boolean ret = nodeSet.add(node); - if (ret) { - epoch++; - } - return ret; - } - - public boolean remove(Node node) { - boolean ret = nodeSet.remove(node); - if (ret) { - epoch++; - } - return ret; - } - - private int epoch; - private TreeSet<Node> nodeSet; -} diff --git a/dog/src/net/osrg/sheepdog/NodeLogOperator.java b/dog/src/net/osrg/sheepdog/NodeLogOperator.java deleted file mode 100644 index d9c0a04..0000000 --- a/dog/src/net/osrg/sheepdog/NodeLogOperator.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.nio.ByteBuffer; -import java.util.TreeSet; - -import net.osrg.sheepdog.headers.NodeResponse; -import net.osrg.sheepdog.headers.Request; - -public class NodeLogOperator { - - public NodeLogOperator() { - } - - public int updateNodeLog(int oldEpoch, int newEpoch, TreeSet<Node> oldSet, TreeSet<Node> newSet) { - NodeList nl; - ObjectOperator objectOperator = new ObjectOperator(); - ByteBuffer object; - SuperObject superObject; - - try { - // TODO use defaultNrCopies in the super block - Log.debug("read the super object"); - nl = new NodeList(oldEpoch, oldSet); - object = objectOperator.readObject(nl, - ObjectOperator.DIRECTORY_OID, -1, - SuperObject.SUPER_OBJ_SIZE + SuperObject.NODE_LOG_SIZE - + 1024 * 1024); - superObject = new SuperObject(object); - nl = new NodeList(newEpoch, newSet); - superObject.addNodeList(nl); - nl = new NodeList(oldEpoch, oldSet); - objectOperator.createObject(nl, ObjectOperator.DIRECTORY_OID, - superObject.getDefaultNrCopies(), superObject.toBuffer()); - } catch (SheepdogException oe) { - OpCode opcode = oe.getOpcode(); - if (opcode == OpCode.OP_READ_OBJ) { - Log.error("failed to read the old log"); - return SheepdogException.DIR_READ; - } else { - Log.error("failed to write the new log"); - return SheepdogException.DIR_WRITE; - } - } - return SheepdogException.SUCCESS; - } - - public int updateEpoch(int epoch, TreeSet<Node> set, long vdiOid, int vdiEpoch) { - NodeList nl; - ObjectOperator objectOperator = new ObjectOperator(); - ByteBuffer object; - SuperObject superObject; - - try { - // TODO use defaultNrCopies in the super block - Log.debug("read the super object"); - nl = new NodeList(epoch, set); - object = objectOperator.readObject(nl, - ObjectOperator.DIRECTORY_OID, -1, - SuperObject.SUPER_OBJ_SIZE + SuperObject.NODE_LOG_SIZE - + 1024 * 1024); - superObject = new SuperObject(object); - int res = superObject.setEpoch(vdiOid, vdiEpoch); - if (res != SheepdogException.SUCCESS) { - return res; - } - nl = new NodeList(epoch, set); - objectOperator.createObject(nl, ObjectOperator.DIRECTORY_OID, - superObject.getDefaultNrCopies(), superObject.toBuffer()); - } catch (SheepdogException oe) { - OpCode opcode = oe.getOpcode(); - if (opcode == OpCode.OP_READ_OBJ) { - Log.error("failed to read the old log"); - return SheepdogException.DIR_READ; - } else { - Log.error("failed to write the new log"); - return SheepdogException.DIR_WRITE; - } - } - return SheepdogException.SUCCESS; - } - - public NodeResponse readPastNodeList(OpCode op, int epoch, TreeSet<Node> set, - int reqEpoch, Request req) { - NodeList nl; - ObjectOperator objectOperator = new ObjectOperator(); - ByteBuffer object; - SuperObject superObject; - - try { - // TODO use defaultNrCopies in the super block - Log.debug("read the super object"); - nl = new NodeList(epoch, set); - object = objectOperator.readObject(nl, - ObjectOperator.DIRECTORY_OID, -1, - SuperObject.SUPER_OBJ_SIZE + SuperObject.NODE_LOG_SIZE - + 1024 * 1024); - superObject = new SuperObject(object); - NodeList nodeList = superObject.getNodeList(reqEpoch); - ByteBuffer data; - int nrNodes = 0; - if (nodeList == null) { - data = null; - } else { - data = nodeList.toRspData(); - nrNodes = nodeList.countNode(); - } - NodeResponse rsp = new NodeResponse(req, op.getValue(), data, 0); - rsp.setNrNodes(nrNodes); - rsp.setLocalIdx(-1); - rsp.setMasterIdx(-1); - if (nodeList == null) { - rsp.setResult(SheepdogException.NO_EPOCH); - } else { - rsp.setResult(SheepdogException.SUCCESS); - } - return rsp; - } catch (SheepdogException oe) { - int result = oe.getErrorCode(); - Log.error("failed to read the old log"); - NodeResponse rsp = new NodeResponse(req, op.getValue(), null, 0); - if (result == SheepdogException.NO_OBJ) { - rsp.setResult(SheepdogException.NO_SUPER_OBJ); - } else { - rsp.setResult(SheepdogException.DIR_READ); - } - return rsp; - } - } - - public int mkfs(int epoch, TreeSet<Node> set, int nrCopies) { - NodeList nl; - SuperObject superObject; - ObjectOperator objectOperator = new ObjectOperator(); - - try { - Log.debug("create the super object (mkfs)"); - superObject = new SuperObject(nrCopies); - nl = new NodeList(epoch + 1, set); - superObject.addNodeList(nl); - nl = new NodeList(epoch, set); - objectOperator.createObject(nl, ObjectOperator.DIRECTORY_OID, nrCopies, - superObject.toBuffer()); - return SheepdogException.SUCCESS; - } catch (SheepdogException e) { - e.printStackTrace(); - Log.error("failed to make fs"); - return SheepdogException.DIR_WRITE; - } - } -} diff --git a/dog/src/net/osrg/sheepdog/ObjectOperator.java b/dog/src/net/osrg/sheepdog/ObjectOperator.java deleted file mode 100644 index 46f34b6..0000000 --- a/dog/src/net/osrg/sheepdog/ObjectOperator.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.net.InetSocketAddress; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.channels.ReadableByteChannel; -import java.nio.channels.SocketChannel; -import java.nio.channels.WritableByteChannel; -import java.util.Arrays; -import java.util.List; -import java.util.LinkedList; -import java.io.IOException; - -import net.osrg.sheepdog.headers.ObjectRequest; -import net.osrg.sheepdog.headers.ObjectResponse; -import net.osrg.sheepdog.headers.Request; -import net.osrg.sheepdog.headers.Response; -import static net.osrg.sheepdog.OpCode.OP_REMOVE_OBJ; -import static net.osrg.sheepdog.OpCode.OP_READ_OBJ; -import static net.osrg.sheepdog.OpCode.OP_WRITE_OBJ; -import static net.osrg.sheepdog.OpCode.OP_CREATE_AND_WRITE_OBJ; - -public class ObjectOperator { - - public static final long DIRECTORY_OID = 0; - - public ObjectOperator() { - } - - public ByteBuffer readObject(NodeList nl, long oid, int copies, int size) throws SheepdogException { - ObjectRequest req = new ObjectRequest(); - req.setOid(oid); - req.setNodeList(nl); - req.setOpcode(OP_READ_OBJ); - req.setCopies(copies); - req.setDataLength(size); - if (nl != null) { - req.setEpoch(nl.getEpoch()); - } else { - Log.error("cannot get node list"); - req.setEpoch(0); - } - return doOperation(req); - } - - public ByteBuffer createObject(NodeList nl, long oid, int copies, - ByteBuffer buf) throws SheepdogException { - return writeObject(nl, OP_CREATE_AND_WRITE_OBJ, oid, copies, buf); - } - - public ByteBuffer writeObject(NodeList nl, long oid, int copies, - ByteBuffer buf) throws SheepdogException { - return writeObject(nl, OP_WRITE_OBJ, oid, copies, buf); - } - - private ByteBuffer writeObject(NodeList nl, OpCode opcode, long oid, - int copies, ByteBuffer buf) throws SheepdogException { - ObjectRequest req = new ObjectRequest(); - req.setOid(oid); - req.setNodeList(nl); - req.setOpcode(opcode); - req.setCopies(copies); - req.setDataLength(buf.remaining()); - req.setData(buf); - req.setFlags(Request.FLAG_CMD_WRITE); - if (nl != null) { - req.setEpoch(nl.getEpoch()); - } else { - Log.error("cannot get node list"); - req.setEpoch(0); - } - return doOperation(req); - } - - public ByteBuffer removeObject(NodeList nl, NodeList maskNodeList, - long oid, int copies) throws SheepdogException { - ObjectRequest req = new ObjectRequest(); - req.setOid(oid); - req.setNodeList(nl); - req.setMaskNodeList(maskNodeList); - req.setOpcode(OP_REMOVE_OBJ); - req.setCopies(copies); - if (nl != null) { - req.setEpoch(nl.getEpoch()); - } else { - Log.error("cannot get node list"); - req.setEpoch(0); - } - return doOperation(req); - } - - private Node objToSheep(NodeList nodeList, long oid, int idx) { - Node[] nodeArray = nodeList.getNodeSet().toArray(new Node[0]); - Node dummyNode = new Node(oid); - int index = Arrays.binarySearch(nodeArray, dummyNode); - if (index < 0) { - index = -index - 1; - } - return nodeArray[(index + idx) % nodeList.countNode()]; - } - - private List<Node> objToSheeps(NodeList nodeList, long oid, int nrCopies) { - return objToSheeps(nodeList, oid, nrCopies, null); - } - - private List<Node> objToSheeps(NodeList nodeList, long oid, int nrCopies, List<Node> masks) { - List<Node> list = new LinkedList<Node>(); - if (nodeList == null) { - return list; - } - for (int i = 0; i < nrCopies; i++) { - Node node = objToSheep(nodeList, oid, i); - if (masks == null || !masks.contains(node)) { - list.add(node); - } - } - return list; - } - - private void doRead(ReadableByteChannel ch, ByteBuffer buf) - throws IOException { - while (buf.hasRemaining()) { - ch.read(buf); - } - } - - private void doWrite(WritableByteChannel ch, ByteBuffer buf) - throws IOException { - while (buf.hasRemaining()) { - ch.write(buf); - } - } - - private synchronized ByteBuffer doOperation(ObjectRequest req) throws SheepdogException { - NodeList nodeList = req.getNodeList(); - NodeList maskNodeList = req.getMaskNodeList(); - int nrCopies; - long oid = req.getOid(); - OpCode opcode = req.getOpcode(); - if (req.getData() != null) { - req.getData().mark(); - } - Log.debug("req.getCopies() = " + req.getCopies()); - nrCopies = req.getCopies(); - if (nrCopies < 0 || nrCopies > nodeList.countNode()) { - nrCopies = nodeList.countNode(); - } - - ByteBuffer rspData = null; - - List<Node> targetNodes; - if (maskNodeList != null) { - List<Node> maskNodes = objToSheeps(maskNodeList, oid, nrCopies); - targetNodes = objToSheeps(nodeList, oid, nrCopies, maskNodes); - } else { - targetNodes = objToSheeps(nodeList, oid, nrCopies); - } - int result = SheepdogException.SUCCESS; - String errMsg = null; - Log.debug("targetNodes = " + targetNodes); - for (Node node : targetNodes) { - try { - InetSocketAddress address; - address = new InetSocketAddress(node.getInetAddress(), node - .getSheepPort()); - SocketChannel ch = SocketChannel.open(); - ch.connect(address); - if (req.getData() != null) { - req.getData().reset(); - } - doWrite(ch, req.toBuffer()); - ByteBuffer buf; - if ((req.getFlags() & Request.FLAG_CMD_WRITE) == Request.FLAG_CMD_WRITE) { - buf = ByteBuffer.allocate(Response.HEADER_SIZE); - } else { - buf = ByteBuffer.allocate(Response.HEADER_SIZE - + req.getDataLength()); - } - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.limit(Response.HEADER_SIZE); - doRead(ch, buf); - buf.flip(); - ObjectResponse rsp = new ObjectResponse(buf); - if ((req.getFlags() & Response.FLAG_CMD_WRITE) != Response.FLAG_CMD_WRITE) { - buf.mark(); - buf.limit(Response.HEADER_SIZE + rsp.getDataLength()); - doRead(ch, buf); - buf.reset(); - rsp.setData(buf); - } - if (opcode == OpCode.OP_READ_OBJ || result == SheepdogException.SUCCESS) { - result = rsp.getResult(); - } - if (rsp.getResult() != SheepdogException.SUCCESS) { - errMsg = "Error: nodeList = " + nodeList - + ", maskNodeList = " + maskNodeList - + ", target = " + node - + ", op = " + opcode - + ", oid = " + oid - + ", code = " + rsp.getResult(); - Log.error(errMsg); - continue; - } - - rspData = ByteBuffer.allocate(rsp.getDataLength()); - rspData.order(ByteOrder.LITTLE_ENDIAN); - rspData.put(rsp.getData()); - rspData.flip(); - - ch.close(); - if (opcode == OpCode.OP_READ_OBJ) { - break; - } - } catch (IOException e) { - errMsg = "cannot access to object " + oid - + ": " + e.getLocalizedMessage(); - Log.error(errMsg); - result = SheepdogException.EIO; - } - } - if (result != SheepdogException.SUCCESS) { - throw new SheepdogException(result, oid, opcode, errMsg); - } - return rspData; - } -} diff --git a/dog/src/net/osrg/sheepdog/OpCode.java b/dog/src/net/osrg/sheepdog/OpCode.java deleted file mode 100644 index cbf7cc5..0000000 --- a/dog/src/net/osrg/sheepdog/OpCode.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.io.Serializable; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -public enum OpCode implements Serializable { - OP_UNKNOWN((byte) 0x00), - - OP_CREATE_AND_WRITE_OBJ((byte) 0x01), - OP_REMOVE_OBJ((byte) 0x02), - OP_READ_OBJ((byte) 0x03), - OP_WRITE_OBJ((byte) 0x04), - OP_SYNC_OBJ((byte) 0x05), - OP_APPEND_OBJ((byte) 0x06), - - OP_NEW_VDI((byte) 0x11), - OP_DEL_VDI((byte) 0x12), - OP_GET_NODE_NAME((byte) 0x13), - OP_GET_MASTER_TID((byte) 0x14), - OP_LOCK_VDI((byte) 0x16), - OP_RELEASE_VDI((byte) 0x17), - OP_GET_VDI_INFO((byte) 0x18), - OP_GET_NODE_LIST((byte) 0x19), - OP_GET_VM_LIST((byte) 0x20), - OP_MAKE_FS((byte) 0x21), - OP_UPDATE_EPOCH((byte) 0x22), - OP_GET_EPOCH((byte) 0x23), - OP_SHUTDOWN((byte) 0x24), - - OP_JOIN((byte) 0x81), - OP_LEAVE((byte) 0x82), - OP_NOP((byte) 0x86), - OP_REMOVE_NODE((byte) 0x87), - OP_UPDATE_NODELIST((byte) 0x88); - - private OpCode(byte v) { - value = v; - } - - private byte value; - - private static final Map<Byte, OpCode> REVERSE_DICTIONARY; - static { - Map<Byte, OpCode> map = new HashMap<Byte, OpCode>(); - for (OpCode elem : OpCode.values()) { - map.put(elem.value, elem); - } - REVERSE_DICTIONARY = Collections.unmodifiableMap(map); - } - - public byte getValue() { - return value; - } - - public static OpCode fromValue(byte v) { - return REVERSE_DICTIONARY.get(v); - } -} diff --git a/dog/src/net/osrg/sheepdog/Sheepdog.java b/dog/src/net/osrg/sheepdog/Sheepdog.java deleted file mode 100644 index 9716b08..0000000 --- a/dog/src/net/osrg/sheepdog/Sheepdog.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.nio.ByteBuffer; -import java.nio.channels.SelectionKey; -import java.nio.channels.Selector; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SocketChannel; -import java.util.HashMap; -import java.util.Iterator; -import java.util.TreeSet; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -import net.osrg.sheepdog.MasterGroup.ROLE; -import net.osrg.sheepdog.headers.NodeRequest; -import net.osrg.sheepdog.headers.NodeResponse; -import net.osrg.sheepdog.headers.ObjectRequest; -import net.osrg.sheepdog.headers.Request; -import net.osrg.sheepdog.headers.Response; -import net.osrg.sheepdog.headers.VdiRequest; -import net.osrg.sheepdog.messages.DelVdiMessage; -import net.osrg.sheepdog.messages.GetVdiInfoMessage; -import net.osrg.sheepdog.messages.GetVmListMessage; -import net.osrg.sheepdog.messages.JoinMessage; -import net.osrg.sheepdog.messages.LeaveMessage; -import net.osrg.sheepdog.messages.MakeFsMessage; -import net.osrg.sheepdog.messages.ReleaseVdiMessage; -import net.osrg.sheepdog.messages.RequestClusterInfoMessage; -import net.osrg.sheepdog.messages.SheepdogMessage; -import net.osrg.sheepdog.messages.NewVdiMessage; -import net.osrg.sheepdog.messages.ShutdownMessage; -import net.osrg.sheepdog.messages.UpdateEpochMessage; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.CommandLineParser; -import org.apache.commons.cli.GnuParser; -import org.apache.commons.cli.HelpFormatter; -import org.apache.commons.cli.Options; -import org.apache.commons.cli.ParseException; -import org.apache.commons.daemon.Daemon; -import org.apache.commons.daemon.DaemonContext; -import org.apache.log4j.Level; -import org.jgroups.Channel; -import org.jgroups.ChannelClosedException; -import org.jgroups.ChannelException; -import org.jgroups.ChannelNotConnectedException; -import org.jgroups.JChannel; -import org.jgroups.Message; -import org.jgroups.ReceiverAdapter; -import org.jgroups.conf.ConfiguratorFactory; -import org.jgroups.conf.ProtocolData; -import org.jgroups.conf.ProtocolParameter; -import org.jgroups.conf.ProtocolStackConfigurator; -import org.jgroups.conf.XmlConfigurator; - -class JGroupsConnector implements Runnable { - private JChannel jch; - private Sheepdog sd; - private MasterGroup mg; - private Lock lock; - private Condition connected; - - public JGroupsConnector(Sheepdog sd, MasterGroup mg, JChannel channel) { - this.sd = sd; - this.mg = mg; - jch = channel; - lock = new ReentrantLock(); - connected = lock.newCondition(); - } - - public void connect() { - lock.lock(); - try { - connected.signal(); - } finally { - lock.unlock(); - } - } - - public void disconnect() { - lock.lock(); - try { - jch.disconnect(); - } finally { - lock.unlock(); - } - } - - @Override - public void run() { - try { - for (;;) { - lock.lock(); - try { - while (jch.isConnected()) { - connected.await(); - } - } finally { - lock.unlock(); - } - mg.initialize(); - jch.connect("Sheepdog cluster"); - // TODO if I am SLAVE and there are too many - // members, disconnect and sleep - sd.connectDone(); - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} - -public class Sheepdog implements ConnectionCallback, Daemon, Runnable { - - public static final int DEFAULT_LIMIT_MBRS = 6; - private int limitMbrs; - - public int getLimitMbrs() { - return limitMbrs; - } - - public void setLimitMbrs(int limitMbrs) { - this.limitMbrs = limitMbrs; - } - - private Node thisNode; - private JChannel channel; - - private HashMap<Integer, SelectionKey> keyMap; - private NodeList currentNodeList; - - public NodeList getNodeList() { - return currentNodeList; - } - - private Selector selector; - private JGroupsConnector connector; - - public static final int DEFAULT_DOG_PORT = 7000; - public static final int DEFAULT_SHEEP_PORT = 10095; - public static final int DEFAULT_MCAST_PORT = 45566; - public static final String DEFAULT_CONF_FILE = "sd.xml"; - private boolean shutdown; - - private BlockingQueue<SheepdogMessage> msgQueue; - private boolean connected; - - public void connectDone() { - try { - SheepdogMessage sm; - sm = new RequestClusterInfoMessage(thisNode, thisNode.hashCode(), channel.getLocalAddress()); - groupMsgCount++; - channel.send(new Message(null, null, sm)); - // ms_key.interestOps(SelectionKey.OP_READ); - lock.lock(); - try { - connected = true; - notConnected.signalAll(); - doneSignal.countDown(); - } finally { - lock.unlock(); - } - } catch (ChannelNotConnectedException e) { - e.printStackTrace(); - } catch (ChannelClosedException e) { - e.printStackTrace(); - } - } - - public void disconnectDone(ROLE role) { - lock.lock(); - try { - groupMsgCount--; - if (role == ROLE.SLAVE && groupMsgCount <= 0) { - connector.disconnect(); - Log.debug("disconnect"); - // ms_key.interestOps(0); - connected = false; - } - } finally { - lock.unlock(); - } - } - - private void accept(SelectionKey key) throws IOException { - ServerSocketChannel ssc = (ServerSocketChannel) key.channel(); - SocketChannel sc = ssc.accept(); - sc.configureBlocking(false); - // register new socket to the selector - SelectionKey sk = sc.register(selector, SelectionKey.OP_READ); - int uid = sk.hashCode(); - sk.attach(new Connection(sk, uid, this)); - keyMap.put(uid, sk); - } - - public static void main(String[] argv) { - Sheepdog sd = new Sheepdog(); - try { - sd.init(argv); - sd.start(); - } catch (Exception e) { - e.printStackTrace(); - } - - Log.debug("exit"); - } - - private int groupMsgCount = 0; - - public void addMessage(SheepdogMessage sm) { - try { - msgQueue.put(sm); - connector.connect(); - } catch (InterruptedException e) { - // TODO auto generated - e.printStackTrace(); - } - } - - public void setResult(int uid, Response rsp) { - SelectionKey sk = keyMap.get(uid); - - sk = keyMap.get(uid); - if (sk == null) { - return; // TODO - } - Connection conn = (Connection) sk.attachment(); - if (currentNodeList != null) { - rsp.setEpoch(currentNodeList.getEpoch()); - } else { - rsp.setEpoch(0); - } - conn.setTxOn(rsp); - selector.wakeup(); - } - - private NodeResponse readNodeList(NodeRequest req, int uid) { - NodeResponse response = null; - int requestEpoch = req.getRequestEpoch(); - NodeList nodeList = currentNodeList; - - if (nodeList.getEpoch() == 0 || doneSignal.getCount() > 0) { - // start up - TreeSet<Node> set = new TreeSet<Node>(); - set.add(thisNode); - nodeList = new NodeList(0, set); - } - - if (requestEpoch != 0) { - int epoch = nodeList.getEpoch(); - if (epoch != 0) { - TreeSet<Node> set = (TreeSet<Node>) nodeList.getNodeSet(); - NodeLogOperator operator = new NodeLogOperator(); - return operator.readPastNodeList(OpCode.OP_GET_NODE_LIST, epoch, - set, requestEpoch, req); - } - response = new NodeResponse(req, OpCode.OP_GET_NODE_LIST.getValue(), null, 0); - response.setResult(SheepdogException.STARTUP); - } else { - response = new NodeResponse(req, OpCode.OP_GET_NODE_LIST.getValue(), nodeList.toRspData(), 0); - response.setResult(SheepdogException.SUCCESS); - } - response.setNrNodes(nodeList.countNode()); - response.setLocalIdx(nodeList.getIndex(thisNode)); - response.setMasterIdx(nodeList.getMasterIndex()); - return response; - } - - @Override - public void rxDone(SelectionKey key, OpCode op, Request req, int uid) - throws IOException { - Connection conn = (Connection) key.attachment(); - Log.debug("ioDone: uid = " + uid + ", cmd = " + op); - - SheepdogMessage sm; - String vdiName; - VdiRequest vdiReq; - - switch (op) { - case OP_NEW_VDI: - case OP_DEL_VDI: - case OP_LEAVE: - case OP_LOCK_VDI: - case OP_RELEASE_VDI: - case OP_GET_VDI_INFO: - case OP_GET_VM_LIST: - case OP_MAKE_FS: - case OP_UPDATE_EPOCH: - int currentEpoch = currentNodeList.getEpoch(); - if (shutdown) { - Response rsp = new Response(); - rsp.setResult(SheepdogException.SHUTDOWN); - rsp.setEpoch(0); - conn.setTxOn(rsp); - return; - } - if (doneSignal.getCount() > 0 || currentEpoch == 0 - && (op != OpCode.OP_MAKE_FS)) { - Response rsp = new Response(); - rsp.setResult(SheepdogException.STARTUP); - rsp.setEpoch(0); - conn.setTxOn(rsp); - return; - } - if (req.getEpoch() < currentEpoch) { - Response rsp = new Response(); - rsp.setResult(SheepdogException.OLD_NODE_VER); - rsp.setEpoch(currentEpoch); - conn.setTxOn(rsp); - return; - } else if (req.getEpoch() > currentEpoch) { - Response rsp = new Response(); - rsp.setResult(SheepdogException.NEW_NODE_VER); - rsp.setEpoch(currentEpoch); - conn.setTxOn(rsp); - return; - } - break; - default: - break; - } - - try { - switch (op) { - case OP_NEW_VDI: - vdiReq = new VdiRequest(req); - vdiName = new String(vdiReq.getData().array()); - vdiName = vdiName.trim(); // remove NULL characters - sm = new NewVdiMessage(thisNode, vdiName, vdiReq.getBaseOid(), - vdiReq.getTag(), vdiReq.getVdiSize(), - vdiReq.getFlags(), uid); - msgQueue.put(sm); - connector.connect(); - break; - case OP_DEL_VDI: - sm = new DelVdiMessage(thisNode, uid); - msgQueue.put(sm); - connector.connect(); - break; - case OP_LEAVE: - sm = new LeaveMessage(thisNode, uid, thisNode); - msgQueue.put(sm); - connector.connect(); - break; - case OP_LOCK_VDI: - vdiReq = new VdiRequest(req); - vdiName = new String(vdiReq.getData().array()); - vdiName = vdiName.trim(); // remove NULL characters - sm = new GetVdiInfoMessage(thisNode, vdiName, vdiReq - .getBaseOid(), vdiReq.getTag(), vdiReq.getVdiSize(), - vdiReq.getFlags(), uid, true); - msgQueue.put(sm); - connector.connect(); - break; - case OP_RELEASE_VDI: - vdiName = new String(req.getData().array()); - vdiName = vdiName.trim(); // remove NULL characters - sm = new ReleaseVdiMessage(thisNode, uid, vdiName); - msgQueue.put(sm); - connector.connect(); - break; - case OP_GET_VDI_INFO: - vdiReq = new VdiRequest(req); - vdiName = new String(vdiReq.getData().array()); - vdiName = vdiName.trim(); // remove NULL characters - sm = new GetVdiInfoMessage(thisNode, vdiName, vdiReq - .getBaseOid(), vdiReq.getTag(), vdiReq.getVdiSize(), - vdiReq.getFlags(), uid, false); - msgQueue.put(sm); - connector.connect(); - break; - case OP_GET_EPOCH: - vdiReq = new VdiRequest(req); - sm = new GetVdiInfoMessage(thisNode, null, vdiReq - .getBaseOid(), vdiReq.getTag(), vdiReq.getVdiSize(), - vdiReq.getFlags(), uid, false); - msgQueue.put(sm); - connector.connect(); - break; - case OP_GET_VM_LIST: - sm = new GetVmListMessage(thisNode, uid); - msgQueue.put(sm); - connector.connect(); - break; - case OP_MAKE_FS: - // TODO do not use ObjectRequest here - ObjectRequest objReq = new ObjectRequest(req); - sm = new MakeFsMessage(thisNode, objReq.getCopies(), uid); - msgQueue.put(sm); - connector.connect(); - break; - case OP_UPDATE_EPOCH: - vdiReq = new VdiRequest(req); - sm = new UpdateEpochMessage(thisNode, vdiReq.getBaseOid(), - vdiReq.getEpoch(), uid); - msgQueue.put(sm); - connector.connect(); - break; - case OP_SHUTDOWN: - sm = new ShutdownMessage(thisNode, uid); - msgQueue.put(sm); - connector.connect(); - break; - case OP_NOP: - shutdown = (req.getId() > 0); - conn.setTxOn(ByteBuffer.allocate(0)); - break; - case OP_UPDATE_NODELIST: - currentNodeList = NodeList.fromLogData(req.getData()); - Log.debug(currentNodeList); - conn.setTxOn(ByteBuffer.allocate(0)); - int nrSubmasters = req.getId(); // TODO - if (nrSubmasters < this.limitMbrs) { - connector.connect(); - } - break; - case OP_GET_NODE_LIST: - NodeResponse nodeResp = readNodeList(new NodeRequest(req), uid); - if (currentNodeList != null) { - if (doneSignal.getCount() > 0) { - nodeResp.setEpoch(0); - } else { - nodeResp.setEpoch(currentNodeList - .getEpoch()); - } - } else { - nodeResp.setEpoch(0); - } - conn.setTxOn(nodeResp); - break; - default: - Log.error("Unknown command: " + op); - break; - } - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - @Override - public void destroy() { - // TODO Auto-generated method stub - } - - private boolean checkJgroups(ProtocolStackConfigurator conf) { - final Lock lock = new ReentrantLock(); - final Condition notConnected = lock.newCondition(); - try { - JChannel channel = new JChannel(conf); - channel.setReceiver(new ReceiverAdapter() { - public void receive(Message msg) { - try { - lock.lock(); - notConnected.signal(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - lock.unlock(); - } - } - }); - lock.lock(); - channel.connect("jgroups test " + thisNode.toString()); - channel.send(new Message(null, null, null)); - long nanosTimeout = notConnected.awaitNanos(3000000000L); - channel.close(); - return (nanosTimeout > 0); - } catch (Exception e) { - e.printStackTrace(); - } finally { - lock.unlock(); - } - return false; - } - - private void init(String[] argv) { - Options options = new Options(); - options.addOption("f", "foreground", false, "run in the foreground"); - options.addOption("c", "conf", true, "config file"); - options.addOption("n", true, "number of master group"); - options.addOption("p", "dport", true, "dog port"); - options.addOption("s", "sport", true, "sheep port"); - options.addOption("m", "mport", true, "multicast port"); - options.addOption("a", true, "bind_addr"); - options.addOption("d", "debug", false, "debug option"); - options.addOption("h", "help", false, "help"); - options.addOption("4", "ipv4", false, "force IPv4"); - options.addOption("6", "ipv6", false, "force IPv6"); - options.addOption("r", "syslog", true, "send logs to the syslog server"); - - CommandLineParser parser = new GnuParser(); - CommandLine cl = null; - int dPort = DEFAULT_DOG_PORT; - int sPort = DEFAULT_SHEEP_PORT; - int mPort = DEFAULT_MCAST_PORT; - int limitMbrs = DEFAULT_LIMIT_MBRS; - String confFile = DEFAULT_CONF_FILE; - - lock = new ReentrantLock(); - notConnected = lock.newCondition(); - - try { - cl = parser.parse(options, argv); - if (cl.hasOption("h")) { - HelpFormatter formatter = new HelpFormatter(); - formatter.printHelp("dog", options, true); - System.exit(1); - } - if (cl.hasOption("c")) { - confFile = cl.getOptionValue("c"); - } - if (cl.hasOption("n")) { - limitMbrs = Integer.parseInt(cl.getOptionValue("n")); - } - if (cl.hasOption("p")) { - dPort = Integer.parseInt(cl.getOptionValue("p")); - } - if (cl.hasOption("s")) { - sPort = Integer.parseInt(cl.getOptionValue("s")); - } - if (cl.hasOption("m")) { - mPort = Integer.parseInt(cl.getOptionValue("m")); - } - if (cl.hasOption("a")) { - System.setProperty("jgroups.bind_addr", cl.getOptionValue("a")); - } - if (cl.hasOption("4")) { - System.setProperty("java.net.preferIPv4Stack", "true"); - } - if (cl.hasOption("6")) { - System.setProperty("java.net.preferIPv6Stack", "true"); - } - if (cl.hasOption("r")) { - Log.useSyslog(cl.getOptionValue("r")); - } else { - Log.useStdout(); - } - if (cl.hasOption("d")) { - Log.setLevel(Level.DEBUG); - } - } catch (ParseException e) { - HelpFormatter formatter = new HelpFormatter(); - System.err.println(e.getLocalizedMessage()); - formatter.printHelp("dog", options, true); - System.exit(1); - } catch (NumberFormatException e) { - HelpFormatter formatter = new HelpFormatter(); - System.err.println(e.getLocalizedMessage() + ": must be a number"); - formatter.printHelp("dog", options, true); - System.exit(1); - } - - try { - thisNode = new Node(InetAddress.getLocalHost(), dPort, sPort); - } catch (UnknownHostException e1) { - // TODO auto generated - e1.printStackTrace(); - } - - try { - ProtocolStackConfigurator conf; - conf = ConfiguratorFactory.getStackConfigurator(confFile); - if (!(conf instanceof XmlConfigurator)) { - HelpFormatter formatter = new HelpFormatter(); - System.err.println("cannot find " + confFile); - formatter.printHelp("dog", options, true); - System.exit(1); - } - ProtocolParameter[] params = new ProtocolParameter[1]; - params[0] = new ProtocolParameter("mcast_port", Integer - .toString(mPort)); - ProtocolData data = new ProtocolData("UDP", params); - ((XmlConfigurator) conf).override(data); - if (!checkJgroups(conf)) { - System.err.println("failed to set up JGroups"); - System.err.println("check the network configuration"); - System.exit(1); - } - channel = new JChannel(conf); - // TODO deal with AUTO_RECONNECT and AUTO_GENSTATE - channel.setOpt(Channel.BLOCK, true); - channel.setOpt(Channel.LOCAL, true); - Master master = new Master(thisNode, this); - - msgQueue = new LinkedBlockingQueue<SheepdogMessage>(); - connected = false; - keyMap = new HashMap<Integer, SelectionKey>(); - currentNodeList = new NodeList(); - this.limitMbrs = limitMbrs; - this.shutdown = false; - - InetSocketAddress address; - ServerSocketChannel ssc = ServerSocketChannel.open(); - ssc.configureBlocking(false); - address = new InetSocketAddress(dPort); - ssc.socket().bind(address); - - selector = Selector.open(); - ssc.register(selector, SelectionKey.OP_ACCEPT); - - MasterGroup mg = new MasterGroup(thisNode, master, this, channel); - connector = new JGroupsConnector(this, mg, channel); - - channel.setReceiver(mg); - - Executor ex = Executors.newCachedThreadPool(); - ex.execute(master); - ex.execute(connector); - ex.execute(new MessageDispatcher()); - } catch (IOException ex) { - ex.printStackTrace(); - } catch (ChannelException ex) { - ex.printStackTrace(); - } - } - - @Override - public void init(DaemonContext dc) throws Exception { - String[] argv = dc.getArguments(); - init(argv); - } - - private CountDownLatch doneSignal; - - private SheepdogMessage createJoinMessage() { - try { - // TODO use defaultNrCopies in the super block - ObjectOperator objectOperator = new ObjectOperator(); - TreeSet<Node> set = new TreeSet<Node>(); - set.add(thisNode); - NodeList nl = new NodeList(0, set); - ByteBuffer object = objectOperator.readObject(nl, ObjectOperator.DIRECTORY_OID, 1, - SuperObject.SUPER_OBJ_SIZE + SuperObject.NODE_LOG_SIZE + 1024 * 1024); - SuperObject superObject = new SuperObject(object); - - return new JoinMessage(thisNode, 0, - superObject.getLastNodeList(), superObject.getCtime(), false); - } catch (SheepdogException oe) { - int result = oe.getErrorCode(); - if (result == SheepdogException.NO_OBJ) { - return new JoinMessage(thisNode, 0, null, 0, false); - } else { - Log.error("failed to read the log"); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO auto-generated - e.printStackTrace(); - } - return createJoinMessage(); - } - } - } - - @Override - public void start() throws Exception { - doneSignal = new CountDownLatch(1); - - Thread thread = new Thread(this); - thread.start(); - - SheepdogMessage sm = createJoinMessage(); - addMessage(sm); - - doneSignal.await(); - } - - @Override - public void stop() throws Exception { - // TODO Auto-generated method stub - } - - private Lock lock; - private Condition notConnected; - - private class MessageDispatcher implements Runnable { - - @Override - public void run() { - for (;;) { - try { - SheepdogMessage sm = msgQueue.take(); - lock.lock(); - try { - while (!connected) { - notConnected.await(); - } - groupMsgCount++; // TODO decrement when cmd is unknown - } finally { - lock.unlock(); - } - channel.send(new Message(null, null, sm)); - } catch (ChannelNotConnectedException e) { - // TODO auto generated - e.printStackTrace(); - } catch (ChannelClosedException e) { - // TODO auto generated - e.printStackTrace(); - } catch (InterruptedException e) { - // TODO auto generated - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - } - - @Override - public void run() { - try { - while (selector.select() >= 0) { - // Get "selected" objects - Iterator<SelectionKey> itr = selector.selectedKeys().iterator(); - while (itr.hasNext()) { - SelectionKey key = itr.next(); - itr.remove(); - - if (!key.isValid()) { - Log.error("key is invalid"); - continue; - } - - if (key.isAcceptable()) { - accept(key); - } else if (key.isReadable()) { - Connection conn = (Connection) key.attachment(); - conn.rxHandler(); - } else if (key.isWritable()) { - Connection conn = (Connection) key.attachment(); - conn.txHandler(); - } - } - } - Log.error("ERROR: select returns unexpectedly"); - channel.close(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/dog/src/net/osrg/sheepdog/SheepdogException.java b/dog/src/net/osrg/sheepdog/SheepdogException.java deleted file mode 100644 index 374ede6..0000000 --- a/dog/src/net/osrg/sheepdog/SheepdogException.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -public class SheepdogException extends Exception { - - public static final int SUCCESS = 0x00; - public static final int UNKNOWN = 0x01; - public static final int NO_OBJ = 0x02; - public static final int EIO = 0x03; - public static final int OLD_NODE_VER = 0x04; - public static final int NEW_NODE_VER = 0x05; - public static final int VDI_EXIST = 0x06; - public static final int INVALID_PARMS = 0x07; - public static final int SYSTEM_ERROR = 0x08; - public static final int VDI_LOCKED = 0x09; - public static final int NO_SUPER_OBJ = 0x0A; - public static final int NO_VDI = 0x0B; - public static final int NO_BASE_VDI = 0x0C; - public static final int DIFFERENT_EPOCH = 0x0D; - public static final int DIR_READ = 0x0E; - public static final int DIR_WRITE = 0x0F; - public static final int VDI_READ = 0x10; - public static final int VDI_WRITE = 0x11; - public static final int BASE_VDI_READ = 0x12; - public static final int BASE_VDI_WRITE = 0x13; - public static final int NO_TAG = 0x14; - public static final int STARTUP = 0x15; - public static final int NO_EPOCH = 0x16; - public static final int VDI_NOT_LOCKED = 0x17; - public static final int SHUTDOWN = 0x18; - - private int errorCode; - private OpCode opcode; - private long oid; - - private static final long serialVersionUID = -4356595263599187642L; - - public SheepdogException(int errorCode, String message) { - super(message); - this.errorCode = errorCode; - this.oid = 0; - this.opcode = OpCode.OP_UNKNOWN; - } - - public SheepdogException(int errorCode, long oid, OpCode opcode, String message) { - super(message); - this.errorCode = errorCode; - this.oid = oid; - this.opcode = opcode; - } - - public int getErrorCode() { - return errorCode; - } - - public OpCode getOpcode() { - return opcode; - } - - public long getOid() { - return oid; - } -} diff --git a/dog/src/net/osrg/sheepdog/SuperObject.java b/dog/src/net/osrg/sheepdog/SuperObject.java deleted file mode 100644 index 5d081df..0000000 --- a/dog/src/net/osrg/sheepdog/SuperObject.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.ArrayList; - -import net.osrg.sheepdog.headers.Request; - -public class SuperObject { - - public static final int SUPER_OBJ_SIZE = 1 << 12; - // TODO these sizes are temporary values - public static final int NODE_LOG_SIZE = 1 << 24; - public static final int DIRECTORY_SIZE = 1 << 24; - - public SuperObject(int defaultNrCopies) { - long tm = System.currentTimeMillis(); - this.ctime = ((tm / 1000) << 32) | ((tm % 1000) * 1000000); - this.defaultNrCopies = (byte) defaultNrCopies; - this.nodeHistory = new ArrayList<NodeList>(); - this.directory = new ArrayList<DirEntry>(); - } - - public SuperObject(ByteBuffer buf) { - buf.mark(); - ctime = buf.getLong(); - defaultNrCopies = buf.get(); - buf.reset(); - buf.position(buf.position() + SUPER_OBJ_SIZE); - buf.mark(); - nodeHistory = new ArrayList<NodeList>(); - NodeList nodeList = null; - long nrNodeList = buf.getLong(); - for (int i = 0; i < nrNodeList; i++) { - nodeList = NodeList.fromLogData(buf); - if (nodeList != null) { - nodeHistory.add(nodeList); - } else { - break; - } - } - buf.reset(); - buf.position(buf.position() + NODE_LOG_SIZE); - directory = new ArrayList<DirEntry>(); - while (buf.hasRemaining()) { - directory.add(new DirEntry(buf)); - } - } - - public ByteBuffer toBuffer() { - ByteBuffer buf = ByteBuffer.allocate(SUPER_OBJ_SIZE - + NODE_LOG_SIZE - + DIRECTORY_SIZE); - buf.mark(); - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.putLong(ctime); - buf.put(defaultNrCopies); - buf.reset(); - buf.position(buf.position() + SUPER_OBJ_SIZE); - buf.mark(); - buf.putLong(nodeHistory.size()); - for (NodeList nodeList : nodeHistory) { - buf.put(nodeList.toLogData()); - } - buf.reset(); - buf.position(buf.position() + NODE_LOG_SIZE); - for (DirEntry ent : directory) { - buf.put(ent.toBuffer()); - } - buf.flip(); - return buf; - } - - public long getCtime() { - return ctime; - } - - public byte getDefaultNrCopies() { - return defaultNrCopies; - } - - public ArrayList<DirEntry> getDirectory() { - return this.directory; - } - - public void addDirEntry(DirEntry dirEntry) { - for (DirEntry ent : directory) { - if (ent.getName().equals(dirEntry.getName())) { - ent.setFlags((byte) (ent.getFlags() & ~Request.FLAG_CMD_WRITE)); - } - } - directory.add(dirEntry); - } - - public void addNodeList(NodeList nodeList) { - nodeHistory.add(nodeList); - } - - public NodeList getNodeList(int epoch) { - // TODO use Comparable and binarySearch - for (NodeList nodeList : nodeHistory) { - if (nodeList.getEpoch() == epoch) { - return nodeList; - } - } - return null; - } - - public NodeList getLastNodeList() { - return nodeHistory.get(nodeHistory.size() - 1); - } - - public int getEpoch(long oid, int epoch) { - for (DirEntry ent : directory) { - if (ent.getOid() == oid) { - return ent.getEpoch(); - } - } - return -1; - } - - public int setEpoch(long oid, int epoch) { - for (DirEntry ent : directory) { - if (ent.getOid() == oid) { - ent.setEpoch(epoch); - return SheepdogException.SUCCESS; - } - } - return SheepdogException.NO_VDI; - } - - public DirEntry findVdi(String vdiName, long tag, long oid) throws SheepdogException { - int result = SheepdogException.NO_VDI; - DirEntry dirEntry = null; - - for (DirEntry ent : directory) { - if (vdiName != null) { // request by name - if (!ent.getName().equals(vdiName)) { - continue; - } - if (ent.getTag() == tag) { - result = SheepdogException.SUCCESS; - dirEntry = ent; - break; - } - if (tag == -1) { - if (ent.getFlags() == Request.FLAG_CMD_WRITE) { - result = SheepdogException.SUCCESS; - dirEntry = ent; - break; - } else { - // current vdi must exist - result = SheepdogException.SYSTEM_ERROR; - } - } else { - result = SheepdogException.NO_TAG; - } - } else { // request by oid - if (ent.getOid() == oid) { - result = SheepdogException.SUCCESS; - dirEntry = ent; - break; - } - } - } - - if (dirEntry == null) { - if (result == SheepdogException.NO_VDI) { - throw new SheepdogException(result, "vdi (" - + vdiName + ") is not found"); - } else if (result == SheepdogException.NO_TAG) { - throw new SheepdogException(result, "vdi tag (" - + tag + ") is not found"); - } else if (result == SheepdogException.SYSTEM_ERROR) { - throw new SheepdogException(result, "there is no current vdi"); - } else { - throw new SheepdogException(SheepdogException.UNKNOWN, "there is no current vdi"); - } - } - return dirEntry; - } - - private long ctime; - private byte defaultNrCopies; - private ArrayList<NodeList> nodeHistory; - private ArrayList<DirEntry> directory; -} diff --git a/dog/src/net/osrg/sheepdog/VdiOperator.java b/dog/src/net/osrg/sheepdog/VdiOperator.java deleted file mode 100644 index 3649f46..0000000 --- a/dog/src/net/osrg/sheepdog/VdiOperator.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog; - -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.TreeSet; - -import net.osrg.sheepdog.headers.Request; -import net.osrg.sheepdog.messages.GetVdiInfoMessage; -import net.osrg.sheepdog.messages.ReleaseVdiMessage; -import net.osrg.sheepdog.messages.NewVdiMessage; -import net.osrg.sheepdog.messages.SheepdogMessage; - -public class VdiOperator { - - private ObjectOperator objectOperator; - private SuperObject superObject; - private Inode inode; - private ArrayList<DirEntry> directory; - private DirEntry dirEntry = null; - private String vdiName; - private long newOid; - private NodeList nl; - private long baseOid; - private long tag; - private long vdiSize; - private short flags; - private OpCode op; - private SheepdogMessage sm; - - public VdiOperator(long baseOid, - long tag, long vdiSize, short flags, String vdiName, - NodeList nl, OpCode op, SheepdogMessage sm) { - this.objectOperator = new ObjectOperator(); - this.nl = nl; - this.baseOid = baseOid; - this.tag = tag; - this.vdiSize = vdiSize; - this.flags = flags; - this.vdiName = vdiName; - this.op = op; - this.sm = sm; - } - - private void lookupVdi(boolean doLock) - throws SheepdogException { - DirEntry dirEntry = null; - try { - // TODO handle larger buffer - ByteBuffer object = objectOperator.readObject(nl, ObjectOperator.DIRECTORY_OID, -1, - SuperObject.SUPER_OBJ_SIZE + SuperObject.NODE_LOG_SIZE + 1024 * 1024); - superObject = new SuperObject(object); - - dirEntry = superObject.findVdi(vdiName, tag, baseOid); - - // TODO use common interface - if (sm instanceof GetVdiInfoMessage) { - GetVdiInfoMessage msg = (GetVdiInfoMessage) sm; - msg.setFlags(dirEntry.getFlags()); - msg.setResult(SheepdogException.SUCCESS); - msg.setOid(dirEntry.getOid()); - msg.setVdiEpoch(dirEntry.getEpoch()); - } else { - ReleaseVdiMessage msg = (ReleaseVdiMessage) sm; - msg.setResult(SheepdogException.SUCCESS); - } - } catch (SheepdogException oe) { - int result = oe.getErrorCode(); - if (result == SheepdogException.NO_OBJ) { - throw new SheepdogException(SheepdogException.NO_SUPER_OBJ, - "directory is not found"); - } else if (result == SheepdogException.OLD_NODE_VER - || result == SheepdogException.NEW_NODE_VER) { - throw new SheepdogException(SheepdogException.DIFFERENT_EPOCH, - "epochs are different between nodes"); - } else { - // unknown error - throw new SheepdogException(SheepdogException.DIR_READ, - "cannot read directory"); - } - } - } - - private void addVdi() throws SheepdogException { - try { - // TODO handle larger buffer - ByteBuffer object = objectOperator.readObject(nl, ObjectOperator.DIRECTORY_OID, -1, - SuperObject.SUPER_OBJ_SIZE + SuperObject.NODE_LOG_SIZE + 1024 * 1024); - superObject = new SuperObject(object); - directory = superObject.getDirectory(); - for (DirEntry ent : directory) { - if (tag == 0 && ent.getName().equals(vdiName)) { - throw new SheepdogException(SheepdogException.VDI_EXIST, vdiName - + " already exists"); - } - } - long oldOid = 0; - if (directory.size() > 0) { - dirEntry = directory.get(directory.size() - 1); - oldOid = dirEntry.getOid(); - } - newOid = oldOid + (1 << 18); - if (baseOid > 0) { - DirEntry baseEntry = superObject.findVdi(null, 0, baseOid); - NodeList pastNodeList = superObject.getNodeList(baseEntry.getEpoch()); - object = objectOperator.readObject(new NodeList(nl.getEpoch(), - (TreeSet<Node>) pastNodeList.getNodeSet()), baseOid, - superObject.getDefaultNrCopies(), Inode.SIZE); - Inode base = new Inode(object); - inode = new Inode(superObject.getDefaultNrCopies(), newOid, - vdiSize, baseOid); - for (int i = 0; i < inode.getDataOid().length; i++) { - inode.getDataOid()[i] = base.getDataOid()[i]; - } - for (int i = 0; i < Inode.MAX_CHILDREN; i++) { - if (base.getChildOid()[i] == 0) { - base.getChildOid()[i] = newOid; - break; - } - } - object = objectOperator.createObject(nl, baseOid, base - .getNrCopies(), base.toBuffer()); - } else { - inode = new Inode(superObject.getDefaultNrCopies(), newOid, - vdiSize, baseOid); - } - object = objectOperator.createObject(nl, newOid, inode.getNrCopies(), - inode.toBuffer()); - dirEntry = new DirEntry(inode.getOid(), (int) tag, - (byte) flags, vdiName, - nl.getEpoch()); - superObject.addDirEntry(dirEntry); - object = objectOperator.createObject(nl, ObjectOperator.DIRECTORY_OID, - superObject.getDefaultNrCopies(), superObject.toBuffer()); - NewVdiMessage msg = (NewVdiMessage) sm; - msg.setFlags(Request.FLAG_CMD_WRITE); - msg.setResult(SheepdogException.SUCCESS); - msg.setOid(inode.getOid()); - msg.setVdiEpoch(dirEntry.getEpoch()); - } catch (SheepdogException oe) { - int result = oe.getErrorCode(); - long oid = oe.getOid(); - OpCode opcode = oe.getOpcode(); - if (result == SheepdogException.NO_OBJ) { - if (oid == 0) { - throw new SheepdogException(SheepdogException.NO_SUPER_OBJ, - "directory is not found"); - } else if (oid == newOid) { - throw new SheepdogException(SheepdogException.NO_VDI, - "vdi is not found"); - } else if (oid == baseOid) { - throw new SheepdogException(SheepdogException.NO_BASE_VDI, - "base vdi is not found"); - } else { - throw new SheepdogException(SheepdogException.NO_VDI, - "object is not found"); - } - } else if (result == SheepdogException.OLD_NODE_VER - || result == SheepdogException.NEW_NODE_VER) { - throw new SheepdogException(SheepdogException.DIFFERENT_EPOCH, - "epochs are different between nodes"); - } else if (opcode == OpCode.OP_READ_OBJ) { - if (oid == 0) { - throw new SheepdogException(SheepdogException.DIR_READ, - "cannot read directory"); - } else if (oid == newOid) { - throw new SheepdogException(SheepdogException.VDI_READ, - "cannot read vdi"); - } else if (oid == baseOid) { - throw new SheepdogException(SheepdogException.BASE_VDI_READ, - "cannot read base vdi"); - } else { - throw new SheepdogException(SheepdogException.EIO, - "failed to read object"); - } - } else { - if (oid == 0) { - throw new SheepdogException(SheepdogException.DIR_WRITE, - "failed to update directory"); - } else if (oid == newOid) { - throw new SheepdogException(SheepdogException.VDI_WRITE, - "failed to create new vdi"); - } else if (oid == baseOid) { - throw new SheepdogException(SheepdogException.BASE_VDI_WRITE, - "failed to update base vdi"); - } else { - throw new SheepdogException(SheepdogException.EIO, - "failed to write object"); - } - } - } - } - - public int doOperation() { - try { - switch (op) { - case OP_NEW_VDI: - addVdi(); - break; - case OP_LOCK_VDI: - lookupVdi(true); - break; - case OP_GET_VDI_INFO: - lookupVdi(false); - break; - default: - Log.error("Unknown opcode: " + op); - break; - } - } catch (SheepdogException ve) { - Log.error(ve); - - // TODO use common interface - switch (op) { - case OP_NEW_VDI: - NewVdiMessage newMsg = (NewVdiMessage) sm; - newMsg.setFlags((short) 0); - newMsg.setResult(ve.getErrorCode()); - newMsg.setVdiEpoch(0); - break; - case OP_LOCK_VDI: - case OP_GET_VDI_INFO: - if (sm instanceof GetVdiInfoMessage) { - GetVdiInfoMessage lockMsg = (GetVdiInfoMessage) sm; - lockMsg.setFlags((short) 0); - lockMsg.setResult(ve.getErrorCode()); - lockMsg.setVdiEpoch(0); - } else { - ReleaseVdiMessage msg = (ReleaseVdiMessage) sm; - msg.setResult(ve.getErrorCode()); - } - break; - default: - break; - } - } - return sm.getResult(); - } -} diff --git a/dog/src/net/osrg/sheepdog/headers/NodeRequest.java b/dog/src/net/osrg/sheepdog/headers/NodeRequest.java deleted file mode 100644 index 16d7fff..0000000 --- a/dog/src/net/osrg/sheepdog/headers/NodeRequest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.headers; - -import java.nio.ByteBuffer; - -public class NodeRequest extends Request { - - private static final long serialVersionUID = -5744819084363637266L; - - public NodeRequest(ByteBuffer buf) { - super(buf); - requestEpoch = buf.getInt(); - } - - public NodeRequest(Request req) { - setProtoVersion(req.getProtoVersion()); - setOpcode(req.getOpcode()); - setFlags(req.getFlags()); - setEpoch(req.getEpoch()); - setId(req.getId()); - setDataLength(req.getDataLength()); - setRemaining(req.getRemaining()); - ByteBuffer buf = req.getRemaining(); - requestEpoch = buf.getInt(); - setData(req.getData()); - } - - public int getRequestEpoch() { - return requestEpoch; - } - - public void setRequestEpoch(int requestEpoch) { - this.requestEpoch = requestEpoch; - } - - private int requestEpoch; -} diff --git a/dog/src/net/osrg/sheepdog/headers/NodeResponse.java b/dog/src/net/osrg/sheepdog/headers/NodeResponse.java deleted file mode 100644 index 1547e60..0000000 --- a/dog/src/net/osrg/sheepdog/headers/NodeResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.headers; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -public class NodeResponse extends Response { - - public NodeResponse(Request req, byte op, ByteBuffer data, int res) { - super(req, op, data, res); - } - - @Override - public ByteBuffer getHeader() { - ByteBuffer buf = ByteBuffer.allocate(HEADER_SIZE); - buf.order(ByteOrder.LITTLE_ENDIAN); - super.fillHeader(buf); - buf.putInt(nrNodes); - buf.putInt(localIdx); - buf.putInt(masterIdx); - for (int i = 0; i < 4; i++) { - buf.putInt(0); - } - buf.flip(); - return buf; - } - - public int getNrNodes() { - return nrNodes; - } - - public void setNrNodes(int nrNodes) { - this.nrNodes = nrNodes; - } - - public int getLocalIdx() { - return localIdx; - } - - public void setLocalIdx(int localIdx) { - this.localIdx = localIdx; - } - - public int getMasterIdx() { - return masterIdx; - } - - public void setMasterIdx(int masterIdx) { - this.masterIdx = masterIdx; - } - - private int nrNodes; - private int localIdx; - private int masterIdx; -} diff --git a/dog/src/net/osrg/sheepdog/headers/ObjectRequest.java b/dog/src/net/osrg/sheepdog/headers/ObjectRequest.java deleted file mode 100644 index a9baa1c..0000000 --- a/dog/src/net/osrg/sheepdog/headers/ObjectRequest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.headers; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -import net.osrg.sheepdog.NodeList; - -public class ObjectRequest extends Request { - - static final long serialVersionUID = 8293249265237308968L; - public ObjectRequest() { - super(); - } - - public ObjectRequest(Request req) { - setProtoVersion(req.getProtoVersion()); - setOpcode(req.getOpcode()); - setFlags(req.getFlags()); - setEpoch(req.getEpoch()); - setId(req.getId()); - setDataLength(req.getDataLength()); - ByteBuffer buf = req.getRemaining(); - oid = buf.getLong(); - cowOid = buf.getLong(); - copies = buf.getInt(); - objVer = buf.getInt(); - offset = buf.getLong(); - } - - @Override - public ByteBuffer toBuffer() { - ByteBuffer buf; - if ((getFlags() & 1) == 1) { - buf = ByteBuffer.allocate(HEADER_SIZE + getDataLength()); - } else { - buf = ByteBuffer.allocate(HEADER_SIZE); - } - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.put(getProtoVersion()); - buf.put(getOpcode().getValue()); - buf.putShort(getFlags()); - buf.putInt(getEpoch()); - buf.putInt(getId()); - buf.putInt(getDataLength()); - - buf.putLong(oid); - buf.putLong(cowOid); - buf.putInt(copies); - buf.putInt(objVer); - buf.putLong(offset); - if ((getFlags() & 1) == 1) { - buf.put(getData()); - } - buf.flip(); - return buf; - } - - public long getOid() { - return oid; - } - public long getCowOid() { - return cowOid; - } - public int getCopies() { - return copies; - } - public int getObjVer() { - return objVer; - } - public long getOffset() { - return offset; - } - - private NodeList nodeList; - private NodeList maskNodeList; - - public NodeList getNodeList() { - return nodeList; - } - - public void setNodeList(NodeList nodeList) { - this.nodeList = nodeList; - } - - public NodeList getMaskNodeList() { - return maskNodeList; - } - - public void setMaskNodeList(NodeList maskNodeList) { - this.maskNodeList = maskNodeList; - } - - private long oid; - - public void setOid(long oid) { - this.oid = oid; - } - - private long cowOid; - private int copies; - - public void setCopies(int copies) { - this.copies = copies; - } - - private int objVer; - private long offset; -} diff --git a/dog/src/net/osrg/sheepdog/headers/ObjectResponse.java b/dog/src/net/osrg/sheepdog/headers/ObjectResponse.java deleted file mode 100644 index 2e7f3a2..0000000 --- a/dog/src/net/osrg/sheepdog/headers/ObjectResponse.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.headers; - -import java.nio.ByteBuffer; - -import net.osrg.sheepdog.OpCode; - -public class ObjectResponse extends Response { - - public ObjectResponse(ByteBuffer buf) { - setProtoVersion(buf.get()); - setOpcode(OpCode.fromValue(buf.get())); - setFlags(buf.getShort()); - setEpoch(buf.getInt()); - setId(buf.getInt()); - setDataLength(buf.getInt()); - setResult(buf.getInt()); - objVer = buf.getInt(); - copies = buf.getInt(); - for (int i = 0; i < 5; i++) { - buf.getInt(); - } - setData(buf.slice()); - } - - public ObjectResponse(Request req, byte op, ByteBuffer data, int res) { - super(req, op, data, res); - } - - public int getObjVer() { - return objVer; - } - - public int getCopies() { - return copies; - } - - private int objVer; - private int copies; -} diff --git a/dog/src/net/osrg/sheepdog/headers/Request.java b/dog/src/net/osrg/sheepdog/headers/Request.java deleted file mode 100644 index e62fefa..0000000 --- a/dog/src/net/osrg/sheepdog/headers/Request.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.headers; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -import net.osrg.sheepdog.OpCode; - -public class Request implements Externalizable { - /** - * - */ - private static final long serialVersionUID = -2749643747232097287L; - public static final int HEADER_SIZE = 48; - public static final short FLAG_CMD_WRITE = 1; - - public Request() { } - - public Request(ByteBuffer buf) { - protoVersion = buf.get(); - opcode = OpCode.fromValue(buf.get()); - flags = buf.getShort(); - epoch = buf.getInt(); - id = buf.getInt(); - dataLength = buf.getInt(); - remaining = ByteBuffer.allocate(32); - remaining.order(ByteOrder.LITTLE_ENDIAN); - buf.get(remaining.array()); - data = buf; - } - - public ByteBuffer toBuffer() { - ByteBuffer buf = ByteBuffer.allocate(HEADER_SIZE + dataLength); - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.put(protoVersion); - buf.put(opcode.getValue()); - buf.putShort(flags); - buf.putInt(epoch); - buf.putInt(id); - buf.putInt(dataLength); - buf.put(remaining); - buf.put(data); - buf.flip(); - return buf; - } - - public byte getProtoVersion() { - return protoVersion; - } - - public void setProtoVersion(byte protoVersion) { - this.protoVersion = protoVersion; - } - - public OpCode getOpcode() { - return opcode; - } - - public void setOpcode(OpCode opcode) { - this.opcode = opcode; - } - - public short getFlags() { - return flags; - } - - public void setFlags(short flags) { - this.flags = flags; - } - - public int getEpoch() { - return epoch; - } - - public void setEpoch(int epoch) { - this.epoch = epoch; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getDataLength() { - return dataLength; - } - - public void setDataLength(int dataLength) { - this.dataLength = dataLength; - } - - public void setData(ByteBuffer data) { - this.data = data; - } - - public ByteBuffer getData() { - return data; - } - - private byte protoVersion; - private OpCode opcode; - private short flags; - private int epoch; - private int id; - private int dataLength; - private ByteBuffer remaining; - public ByteBuffer getRemaining() { - return remaining; - } - - public void setRemaining(ByteBuffer remaining) { - this.remaining = remaining; - } - - private ByteBuffer data; - - @Override - public void readExternal(ObjectInput in) throws IOException, - ClassNotFoundException { - ByteBuffer header = ByteBuffer.allocate(HEADER_SIZE); - header.order(ByteOrder.LITTLE_ENDIAN); - int offset = 0; - int length = HEADER_SIZE; - while (offset < length) { - int ret = in.read(header.array(), offset, length - offset); - offset += ret; - } - // TODO redundant codes - protoVersion = header.get(); - opcode = OpCode.fromValue(header.get()); - flags = header.getShort(); - epoch = header.getInt(); - id = header.getInt(); - dataLength = header.getInt(); - remaining = ByteBuffer.allocate(32); - remaining.order(ByteOrder.LITTLE_ENDIAN); - header.get(remaining.array()); - - this.data = ByteBuffer.allocate(dataLength); - this.data.order(ByteOrder.LITTLE_ENDIAN); - offset = 0; - length = dataLength; - while (offset < length) { - int ret = in.read(this.data.array(), offset, length - offset); - offset += ret; - } - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - out.write(toBuffer().array()); - } -} diff --git a/dog/src/net/osrg/sheepdog/headers/Response.java b/dog/src/net/osrg/sheepdog/headers/Response.java deleted file mode 100644 index bec9dc1..0000000 --- a/dog/src/net/osrg/sheepdog/headers/Response.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.headers; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -import net.osrg.sheepdog.OpCode; - -public class Response { - public static final int HEADER_SIZE = 48; - public static final short FLAG_CMD_WRITE = 1; - - public Response(ByteBuffer buf) { - protoVersion = buf.get(); - setOpcode(OpCode.fromValue(buf.get())); - flags = buf.getShort(); - epoch = buf.getInt(); - id = buf.getInt(); - dataLength = buf.getInt(); - result = buf.getInt(); - for (int i = 0; i < 7; i++) { - buf.getInt(); - } - setData(buf.slice()); - } - - public Response(Request req, byte op, ByteBuffer data, int res) { - if (data == null) { - data = ByteBuffer.allocate(0); - } - if (req == null) { - ByteBuffer buf = ByteBuffer.allocate(Request.HEADER_SIZE); - buf.order(ByteOrder.LITTLE_ENDIAN); - req = new Request(buf); - } - protoVersion = req.getProtoVersion(); - opcode = OpCode.fromValue(op); - flags = req.getFlags(); - epoch = req.getEpoch(); - id = req.getId(); - dataLength = data.limit(); - result = res; - this.data = data; - if (data.remaining() > 0) { - flags = FLAG_CMD_WRITE; - } - } - - public Response() { - opcode = OpCode.OP_UNKNOWN; - data = ByteBuffer.allocate(0); - data.order(ByteOrder.LITTLE_ENDIAN); - } - - public void fillHeader(ByteBuffer buf) { - buf.put(protoVersion); - buf.put(opcode.getValue()); - buf.putShort(flags); - buf.putInt(epoch); - buf.putInt(id); - buf.putInt(dataLength); - buf.putInt(result); - } - - public ByteBuffer getHeader() { - ByteBuffer buf = ByteBuffer.allocate(HEADER_SIZE + data.limit()); - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.put(protoVersion); - buf.put(opcode.getValue()); - buf.putShort(flags); - buf.putInt(epoch); - buf.putInt(id); - buf.putInt(dataLength); - buf.putInt(result); - for (int i = 0; i < 7; i++) { - buf.putInt(0); - } - buf.flip(); - return buf; - } - - public byte getProtoVersion() { - return protoVersion; - } - - public OpCode getOpcode() { - return opcode; - } - - public short getFlags() { - return flags; - } - - public int getEpoch() { - return epoch; - } - - public int getId() { - return id; - } - - public int getDataLength() { - return dataLength; - } - - public int getResult() { - return result; - } - - public void setResult(int result) { - this.result = result; - } - - public void setData(ByteBuffer data) { - this.data = data; - } - - public ByteBuffer getData() { - return data; - } - - private byte protoVersion; - private OpCode opcode; - private short flags; - - public void setProtoVersion(byte protoVersion) { - this.protoVersion = protoVersion; - } - - public void setOpcode(OpCode opcode) { - this.opcode = opcode; - } - - public void setFlags(short flags) { - this.flags = flags; - } - - public void setEpoch(int epoch) { - this.epoch = epoch; - } - - public void setId(int id) { - this.id = id; - } - - public void setDataLength(int dataLength) { - this.dataLength = dataLength; - } - - private int epoch; - private int id; - private int dataLength; - private int result; - private ByteBuffer data; -} diff --git a/dog/src/net/osrg/sheepdog/headers/VdiRequest.java b/dog/src/net/osrg/sheepdog/headers/VdiRequest.java deleted file mode 100644 index 60d775f..0000000 --- a/dog/src/net/osrg/sheepdog/headers/VdiRequest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.headers; - -import java.nio.ByteBuffer; - -public class VdiRequest extends Request { - - static final long serialVersionUID = 6790105034454796955L; - public VdiRequest(ByteBuffer buf) { - super(buf); - baseOid = buf.getLong(); - tag = buf.getLong(); - vdiSize = buf.getLong(); - } - - public VdiRequest(Request req) { - setProtoVersion(req.getProtoVersion()); - setOpcode(req.getOpcode()); - setFlags(req.getFlags()); - setEpoch(req.getEpoch()); - setId(req.getId()); - setDataLength(req.getDataLength()); - ByteBuffer buf = req.getRemaining(); - baseOid = buf.getLong(); - tag = buf.getLong(); - vdiSize = buf.getLong(); - setData(req.getData()); - } - - public long getBaseOid() { - return baseOid; - } - - public void setBaseOid(long baseOid) { - this.baseOid = baseOid; - } - - public long getTag() { - return tag; - } - - public void setTag(long tag) { - this.tag = tag; - } - - public long getVdiSize() { - return vdiSize; - } - - public void setVdiSize(long vdiSize) { - this.vdiSize = vdiSize; - } - - private long baseOid; - private long tag; - private long vdiSize; - -} diff --git a/dog/src/net/osrg/sheepdog/headers/VdiResponse.java b/dog/src/net/osrg/sheepdog/headers/VdiResponse.java deleted file mode 100644 index f92bd6a..0000000 --- a/dog/src/net/osrg/sheepdog/headers/VdiResponse.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.headers; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -public class VdiResponse extends Response { - - public VdiResponse(Request req, byte op, ByteBuffer data, int res) { - super(req, op, data, res); - } - - public VdiResponse() { - super(); - } - - public int getRsvd() { - return rsvd; - } - - public void setRsvd(int rsvd) { - this.rsvd = rsvd; - } - - public long getOid() { - return oid; - } - - public void setOid(long oid) { - this.oid = oid; - } - - public void setVdiEpoch(int vdiEpoch) { - this.vdiEpoch = vdiEpoch; - } - - public int getVdiEpoch() { - return vdiEpoch; - } - - @Override - public ByteBuffer getHeader() { - ByteBuffer buf = ByteBuffer.allocate(HEADER_SIZE + getData().limit()); - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.put(getProtoVersion()); - buf.put(getOpcode().getValue()); - buf.putShort(getFlags()); - buf.putInt(getEpoch()); - buf.putInt(getId()); - buf.putInt(getDataLength()); - buf.putInt(getResult()); - buf.putInt(rsvd); - buf.putLong(oid); - buf.putInt(vdiEpoch); - for (int i = 0; i < 3; i++) { - buf.putInt(0); - } - buf.flip(); - return buf; - } - - private int rsvd; - private long oid; - private int vdiEpoch; -} diff --git a/dog/src/net/osrg/sheepdog/messages/DelVdiMessage.java b/dog/src/net/osrg/sheepdog/messages/DelVdiMessage.java deleted file mode 100644 index 06f0115..0000000 --- a/dog/src/net/osrg/sheepdog/messages/DelVdiMessage.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.headers.Response; - -public class DelVdiMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = 4712886975118264261L; - - public DelVdiMessage(Node from, int connectionId) { - super(from, connectionId); - } - - @Override - public Response reply(ClusterInformation ci) { - return null; - } - - @Override - public void updateSuperObject(ClusterInformation ci) { - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - } -} diff --git a/dog/src/net/osrg/sheepdog/messages/GetVdiInfoMessage.java b/dog/src/net/osrg/sheepdog/messages/GetVdiInfoMessage.java deleted file mode 100644 index fd21a62..0000000 --- a/dog/src/net/osrg/sheepdog/messages/GetVdiInfoMessage.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.OpCode; -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.SheepdogException; -import net.osrg.sheepdog.VdiOperator; -import net.osrg.sheepdog.headers.Response; -import net.osrg.sheepdog.headers.VdiResponse; - -public class GetVdiInfoMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = -385617943560301236L; - private boolean lock; - private String vdiName; - private long baseOid; - private long tag; - private long vdiSize; - private short flags; - private long oid; - private int vdiEpoch; - - public void setFlags(short flags) { - this.flags = flags; - } - - public void setOid(long oid) { - this.oid = oid; - } - - public void setVdiEpoch(int vdiEpoch) { - this.vdiEpoch = vdiEpoch; - } - - public GetVdiInfoMessage(Node from, String vdiName, long baseOid, - long tag, long vdiSize, short flags, int connectionId, - boolean lock) { - super(from, connectionId); - this.vdiName = vdiName; - this.baseOid = baseOid; - this.tag = tag; - this.vdiSize = vdiSize; - this.flags = flags; - this.lock = lock; - setResult(SheepdogException.SUCCESS); - } - - @Override - public Response reply(ClusterInformation ci) { - VdiResponse vdiRsp = new VdiResponse(); - vdiRsp.setOid(oid); - vdiRsp.setFlags(flags); - vdiRsp.setVdiEpoch(vdiEpoch); - vdiRsp.setResult(getResult()); - return vdiRsp; - } - - @Override - public void updateSuperObject(ClusterInformation ci) { - OpCode op; // TODO remove this - if (lock) { - op = OpCode.OP_LOCK_VDI; - } else { - op = OpCode.OP_GET_VDI_INFO; - } - VdiOperator vdiOp = new VdiOperator(baseOid, tag, vdiSize, flags, vdiName, ci.getNodeList(), op, this); - vdiOp.doOperation(); - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - if (lock && getResult() == SheepdogException.SUCCESS) { - int ret = -1; - try { - ret = ci.lock(vdiName, getFrom()); - } catch (Exception e) { - e.printStackTrace(); - } - // TODO merge to Exception - if (ret < 0) { - setResult(SheepdogException.VDI_LOCKED); - } - } - } -} diff --git a/dog/src/net/osrg/sheepdog/messages/GetVmListMessage.java b/dog/src/net/osrg/sheepdog/messages/GetVmListMessage.java deleted file mode 100644 index d9b67a2..0000000 --- a/dog/src/net/osrg/sheepdog/messages/GetVmListMessage.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import java.nio.ByteBuffer; - -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.headers.Response; - -public class GetVmListMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = 8659440019009075416L; - - public GetVmListMessage(Node from, int connectionId) { - super(from, connectionId); - } - - @Override - public Response reply(ClusterInformation ci) { - Response rsp = new Response(); - ByteBuffer buf = ci.encodeLockTbl(); - rsp.setData(buf); - rsp.setDataLength(buf.remaining()); - if (buf.remaining() > 0) { - rsp.setFlags((short) 1); - } - return rsp; - } - - @Override - public void updateSuperObject(ClusterInformation ci) { - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - } -} diff --git a/dog/src/net/osrg/sheepdog/messages/JoinMessage.java b/dog/src/net/osrg/sheepdog/messages/JoinMessage.java deleted file mode 100644 index e6f379d..0000000 --- a/dog/src/net/osrg/sheepdog/messages/JoinMessage.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import java.util.TreeSet; - -import net.osrg.sheepdog.Log; -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.NodeList; -import net.osrg.sheepdog.NodeLogOperator; -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.SheepdogException; -import net.osrg.sheepdog.headers.Response; - -public class JoinMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = 6864895435522827559L; - private NodeList startupNodeList; - private boolean startSheepdog; - private long ctime; - - public JoinMessage(Node from, int connectionId, NodeList startupNodeList, long ctime, boolean startSheepdog) { - super(from, connectionId); - this.startupNodeList = startupNodeList; - this.ctime = ctime; - this.startSheepdog = startSheepdog; - } - - @Override - public Response reply(ClusterInformation ci) { - // TODO implement me - return null; - } - - @SuppressWarnings("unchecked") - @Override - public void updateSuperObject(ClusterInformation ci) { - NodeList latestStartupList = startupNodeList; - if (startupNodeList == null - || ci.getStartupNodeList() != null - && ci.getStartupNodeList().getEpoch() < startupNodeList.getEpoch()) { - latestStartupList = ci.getStartupNodeList(); - } - - NodeList nodeList = ci.nodeList; - int epoch = nodeList.getEpoch(); - // TODO implement NodeList.clone - NodeList nextNodeList = NodeList.fromLogData(nodeList - .toLogData()); - nextNodeList.getNodeSet().add(getFrom()); - if (!ci.isInitialized() - && nextNodeList.containsAll(latestStartupList)) { - NodeList oldNodeList = latestStartupList; - NodeList newNodeList = nextNodeList; - TreeSet<Node> oldSet, newSet; - oldSet = (TreeSet<Node>) oldNodeList.getNodeSet(); - newSet = (TreeSet<Node>) newNodeList.getNodeSet(); - if (!newSet.equals(oldSet)) { - epoch = oldNodeList.getEpoch(); - NodeLogOperator operator = new NodeLogOperator(); - int result = operator.updateNodeLog(0, epoch + 1, oldSet, newSet); - setResult(result); - } - startSheepdog = true; - } else { - TreeSet<Node> oldSet, newSet; - oldSet = (TreeSet<Node>) nodeList.getNodeSet(); - newSet = (TreeSet<Node>) oldSet.clone(); - newSet.add(getFrom()); - if (ci.isInitialized()) { - NodeLogOperator operator = new NodeLogOperator(); - int result = operator.updateNodeLog(epoch, epoch + 1, oldSet, newSet); - setResult(result); - } - startSheepdog = false; - } - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - Log.debug(getFrom().toString()); - if (startupNodeList != null) { - if (ci.getStartupNodeList() == null || ci.getCtime() < ctime - || ci.getCtime() == ctime && ci.getStartupNodeList().getEpoch() < startupNodeList - .getEpoch()) { - ci.addStartupNodeList(startupNodeList, ctime); - } - } - if (getResult() == SheepdogException.SUCCESS) { - ci.join(getFrom()); - } - if (startSheepdog) { - if (ci.nodeList.getNodeSet().equals(startupNodeList.getNodeSet())) { - ci.nodeList.setEpoch(startupNodeList.getEpoch()); - } else { - ci.nodeList.setEpoch(startupNodeList.getEpoch() + 1); - } - ci.setInitialized(true); - } - } -} diff --git a/dog/src/net/osrg/sheepdog/messages/LeaveMessage.java b/dog/src/net/osrg/sheepdog/messages/LeaveMessage.java deleted file mode 100644 index b629566..0000000 --- a/dog/src/net/osrg/sheepdog/messages/LeaveMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import java.util.TreeSet; - -import net.osrg.sheepdog.Log; -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.NodeList; -import net.osrg.sheepdog.NodeLogOperator; -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.headers.Response; - -public class LeaveMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = -9205012528477623953L; - private Node targetNode; - - public LeaveMessage(Node from, int connectionId, Node targetNode) { - super(from, connectionId); - this.targetNode = targetNode; - } - - @Override - public Response reply(ClusterInformation ci) { - // TODO implement me - return null; - } - - @SuppressWarnings("unchecked") - @Override - public void updateSuperObject(ClusterInformation ci) { - NodeList nodeList = ci.nodeList; - int epoch = nodeList.getEpoch(); - TreeSet<Node> oldSet, newSet; - oldSet = (TreeSet<Node>) nodeList.getNodeSet(); - newSet = (TreeSet<Node>) oldSet.clone(); - newSet.remove(targetNode); - NodeLogOperator operator = new NodeLogOperator(); - int result = operator.updateNodeLog(epoch, epoch + 1, oldSet, newSet); - setResult(result); - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - Log.debug("remove node " + targetNode + " from mgroups"); - try { - ci.leave(targetNode); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public Node getTargetNode() { - return targetNode; - } -} diff --git a/dog/src/net/osrg/sheepdog/messages/MakeFsMessage.java b/dog/src/net/osrg/sheepdog/messages/MakeFsMessage.java deleted file mode 100644 index caa8532..0000000 --- a/dog/src/net/osrg/sheepdog/messages/MakeFsMessage.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import java.util.TreeSet; - -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.NodeLogOperator; -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.headers.Response; - -public class MakeFsMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = 8251849116343377179L; - private int copies; - - public MakeFsMessage(Node from, int copies, int connectionId) { - super(from, connectionId); - this.copies = copies; - } - - @Override - public Response reply(ClusterInformation ci) { - Response rsp = new Response(); - rsp.setResult(getResult()); - return rsp; - } - - @Override - public void updateSuperObject(ClusterInformation ci) { - int epoch = ci.nodeList.getEpoch(); - if (!ci.isInitialized()) { - epoch = 0; - } - TreeSet<Node> set; - set = (TreeSet<Node>) ci.nodeList.getNodeSet(); - - NodeLogOperator operator = new NodeLogOperator(); - int result = operator.mkfs(epoch, set, copies); - setResult(result); - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - if (!ci.isInitialized()) { - ci.setInitialized(true); - ci.nodeList.setEpoch(1); - } else { - ci.nodeList.setEpoch(ci.nodeList.getEpoch() + 1); - } - } -} diff --git a/dog/src/net/osrg/sheepdog/messages/MasterChangedMessage.java b/dog/src/net/osrg/sheepdog/messages/MasterChangedMessage.java deleted file mode 100644 index ee6c99b..0000000 --- a/dog/src/net/osrg/sheepdog/messages/MasterChangedMessage.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.headers.Response; - -public class MasterChangedMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = 1290772313197590688L; - - public MasterChangedMessage(Node from, int messageId) { - super(from, messageId); - } - - @Override - public Response reply(ClusterInformation ci) { - return null; - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - } - - @Override - public void updateSuperObject(ClusterInformation ci) { - } - -} diff --git a/dog/src/net/osrg/sheepdog/messages/NewVdiMessage.java b/dog/src/net/osrg/sheepdog/messages/NewVdiMessage.java deleted file mode 100644 index 8caba13..0000000 --- a/dog/src/net/osrg/sheepdog/messages/NewVdiMessage.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.OpCode; -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.SheepdogException; -import net.osrg.sheepdog.VdiOperator; -import net.osrg.sheepdog.headers.Response; -import net.osrg.sheepdog.headers.VdiResponse; - -public class NewVdiMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = 1135149371238643248L; - private String vdiName; - private long baseOid; - private long tag; - private long vdiSize; - private short flags; - private long oid; - private int vdiEpoch; - - public void setFlags(short flags) { - this.flags = flags; - } - - public void setOid(long oid) { - this.oid = oid; - } - - public void setVdiEpoch(int vdiEpoch) { - this.vdiEpoch = vdiEpoch; - } - - public NewVdiMessage(Node from, String vdiName, long baseOid, - long tag, long vdiSize, short flags, int connectionId) { - super(from, connectionId); - this.vdiName = vdiName; - this.baseOid = baseOid; - this.tag = tag; - this.vdiSize = vdiSize; - this.flags = flags; - setResult(SheepdogException.SUCCESS); - } - - @Override - public Response reply(ClusterInformation ci) { - VdiResponse vdiRsp = new VdiResponse(); - vdiRsp.setOid(oid); - vdiRsp.setFlags(flags); - vdiRsp.setVdiEpoch(vdiEpoch); - vdiRsp.setResult(getResult()); - return vdiRsp; - } - - @Override - public void updateSuperObject(ClusterInformation ci) { - VdiOperator vdiOp = new VdiOperator(baseOid, tag, vdiSize, flags, vdiName, ci.getNodeList(), - OpCode.OP_NEW_VDI, this); - vdiOp.doOperation(); - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - } -} diff --git a/dog/src/net/osrg/sheepdog/messages/ReleaseVdiMessage.java b/dog/src/net/osrg/sheepdog/messages/ReleaseVdiMessage.java deleted file mode 100644 index 3d6cb9b..0000000 --- a/dog/src/net/osrg/sheepdog/messages/ReleaseVdiMessage.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.OpCode; -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.SheepdogException; -import net.osrg.sheepdog.VdiOperator; -import net.osrg.sheepdog.headers.Response; - -public class ReleaseVdiMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = 4693006050073828817L; - private String vdiName; - - public ReleaseVdiMessage(Node from, int connectionId, String vdiName) { - super(from, connectionId); - this.vdiName = vdiName; - } - - @Override - public Response reply(ClusterInformation ci) { - Response rsp = new Response(); - rsp.setResult(getResult()); - return rsp; - } - - @Override - public void updateSuperObject(ClusterInformation ci) { - OpCode op; // TODO remove this - op = OpCode.OP_GET_VDI_INFO; - VdiOperator vdiOp = new VdiOperator((long) 0, (long) -1, (long) 0, (short) 0, vdiName, ci.getNodeList(), op, this); - vdiOp.doOperation(); - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - int ret = -1; - if (getResult() == SheepdogException.SUCCESS) { - try { - ret = ci.unlock(vdiName); - } catch (Exception e) { - e.printStackTrace(); - } - // TODO merge to Exception - if (ret < 0) { - setResult(SheepdogException.VDI_NOT_LOCKED); - } - } - } - -} diff --git a/dog/src/net/osrg/sheepdog/messages/RequestClusterInfoMessage.java b/dog/src/net/osrg/sheepdog/messages/RequestClusterInfoMessage.java deleted file mode 100644 index 4fb3e7d..0000000 --- a/dog/src/net/osrg/sheepdog/messages/RequestClusterInfoMessage.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import org.jgroups.Address; - -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.headers.Response; - -public class RequestClusterInfoMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = -3798212834994474954L; - private ClusterInformation clusterInfo; - private Address addr; - - public RequestClusterInfoMessage(Node from, int connectionId, Address localAddress) { - super(from, connectionId); - this.addr = localAddress; - } - - public RequestClusterInfoMessage(Node from, int connectionId, - Address addr, ClusterInformation clusterInfo) { - super(from, connectionId); - this.addr = addr; - this.clusterInfo = clusterInfo; - } - - @Override - public Response reply(ClusterInformation ci) { - return null; - } - - @Override - public void updateSuperObject(ClusterInformation ci) { - clusterInfo = ci; - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - ci.merge(clusterInfo); - } - - public ClusterInformation getClusterInfo() { - return clusterInfo; - } - - public Address getAddr() { - return addr; - } -} diff --git a/dog/src/net/osrg/sheepdog/messages/SheepdogMessage.java b/dog/src/net/osrg/sheepdog/messages/SheepdogMessage.java deleted file mode 100644 index b231345..0000000 --- a/dog/src/net/osrg/sheepdog/messages/SheepdogMessage.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import java.io.Serializable; - -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.headers.Response; - -public abstract class SheepdogMessage implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -8802080283453471007L; - - private final Node from; - private final int messageId; - private boolean flushed; - private int result; - - public SheepdogMessage(Node from, int messageId) { - this.from = from; - this.messageId = messageId; - this.flushed = false; - } - - public Node getFrom() { - return from; - } - - public int getMessageId() { - return messageId; - } - - public void setResult(int result) { - this.result = result; - } - - public int getResult() { - return result; - } - - public void setFlushed(boolean flushed) { - this.flushed = flushed; - } - - public boolean isFlushed() { - return flushed; - } - - public abstract void updateSuperObject(ClusterInformation ci); - - public abstract void updateClusterInfo(ClusterInformation ci); - - public abstract Response reply(ClusterInformation ci); -} diff --git a/dog/src/net/osrg/sheepdog/messages/ShutdownMessage.java b/dog/src/net/osrg/sheepdog/messages/ShutdownMessage.java deleted file mode 100644 index 8ed6218..0000000 --- a/dog/src/net/osrg/sheepdog/messages/ShutdownMessage.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.osrg.sheepdog.messages; - -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.SheepdogException; -import net.osrg.sheepdog.headers.Response; - -public class ShutdownMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = -4309229228671192242L; - - public ShutdownMessage(Node from, int messageId) { - super(from, messageId); - setResult(SheepdogException.SUCCESS); - } - - @Override - public Response reply(ClusterInformation ci) { - Response rsp = new Response(); - rsp.setResult(getResult()); - return rsp; - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - ci.setShutdown(true); - } - - @Override - public void updateSuperObject(ClusterInformation ci) { - ci.setShutdown(true); - } - -} diff --git a/dog/src/net/osrg/sheepdog/messages/UpdateEpochMessage.java b/dog/src/net/osrg/sheepdog/messages/UpdateEpochMessage.java deleted file mode 100644 index ef4ef94..0000000 --- a/dog/src/net/osrg/sheepdog/messages/UpdateEpochMessage.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.osrg.sheepdog.messages; - -import java.util.TreeSet; - -import net.osrg.sheepdog.Node; -import net.osrg.sheepdog.NodeList; -import net.osrg.sheepdog.NodeLogOperator; -import net.osrg.sheepdog.ClusterInformation; -import net.osrg.sheepdog.SheepdogException; -import net.osrg.sheepdog.headers.Response; - -public class UpdateEpochMessage extends SheepdogMessage { - - /** - * - */ - private static final long serialVersionUID = 8873948460930455590L; - private long oid; - private int vdiEpoch; - - public UpdateEpochMessage(Node from, long oid, int vdiEpoch, - int connectionId) { - super(from, connectionId); - this.oid = oid; - this.vdiEpoch = vdiEpoch; - setResult(SheepdogException.SUCCESS); - } - - @Override - public Response reply(ClusterInformation ci) { - Response rsp = new Response(); - rsp.setResult(getResult()); - return rsp; - } - - @Override - public void updateSuperObject(ClusterInformation ci) { - NodeList nodeList = ci.getNodeList(); - int epoch = nodeList.getEpoch(); - TreeSet<Node> nodeSet = (TreeSet<Node>) nodeList.getNodeSet(); - NodeLogOperator operator = - new NodeLogOperator(); - int result = operator.updateEpoch(epoch, nodeSet, oid, vdiEpoch); - setResult(result); - } - - @Override - public void updateClusterInfo(ClusterInformation ci) { - } - -} diff --git a/install-sh b/install-sh deleted file mode 100755 index 4d4a951..0000000 --- a/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2005-05-14.22 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/sheep/Makefile.in b/sheep/Makefile.in deleted file mode 100644 index e0ab204..0000000 --- a/sheep/Makefile.in +++ /dev/null @@ -1,31 +0,0 @@ -CFLAGS += -g -O2 -Wall -Wstrict-prototypes -I../include -CFLAGS += -D_GNU_SOURCE -LIBS += -lpthread -lcrypto - -PROGRAMS = sheep -SHEEP_OBJS = sheep.o store.o net.o work.o ../lib/event.o ../lib/net.o ../lib/logger.o -SHEEP_DEP = $(SHEEP_OBJS:.o=.d) - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ - -.PHONY:all -all: $(PROGRAMS) - -sheep: $(SHEEP_OBJS) - $(CC) $^ -o $@ $(LIBS) - --include $(SHEEP_DEP) - -%.o: %.c - $(CC) -c $(CFLAGS) $*.c -o $*.o - @$(CC) -MM $(CFLAGS) -MF $*.d -MT $*.o $*.c - -.PHONY:clean -clean: - rm -f *.[od] $(PROGRAMS) - -.PHONY:install -install: $(PROGRAMS) - install $< $(bindir) diff --git a/sheep/net.c b/sheep/net.c deleted file mode 100644 index bcc1f17..0000000 --- a/sheep/net.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#include <errno.h> -#include <fcntl.h> -#include <netdb.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <arpa/inet.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <sys/epoll.h> -#include <sys/socket.h> -#include <sys/stat.h> -#include <sys/types.h> - -#include "sheep.h" -#include "util.h" - -static struct request *alloc_request(struct client_info *ci, int data_length) -{ - struct request *req; - - req = zalloc(sizeof(struct request) + data_length); - if (!req) - return NULL; - - req->ci = ci; - if (data_length) - req->data = (char *)req + sizeof(*req); - - list_add(&req->r_siblings, &ci->reqs); - INIT_LIST_HEAD(&req->r_wlist); - - return req; -} - -static void free_request(struct request *req) -{ - list_del(&req->r_siblings); - free(req); -} - -static void req_done(struct request *req) -{ - list_add(&req->r_wlist, &req->ci->done_reqs); - conn_tx_on(&req->ci->conn); -} - -static void init_rx_hdr(struct client_info *ci) -{ - ci->conn.c_rx_state = C_IO_HEADER; - ci->rx_req = NULL; - ci->conn.rx_length = sizeof(struct sd_req); - ci->conn.rx_buf = &ci->conn.rx_hdr; -} - -static void client_rx_handler(struct client_info *ci) -{ - int ret; - uint64_t data_len; - struct connection *conn = &ci->conn; - struct sd_req *hdr = &conn->rx_hdr; - struct request *req; - - switch (conn->c_rx_state) { - case C_IO_HEADER: - ret = rx(conn, C_IO_DATA_INIT); - if (!ret || conn->c_rx_state != C_IO_DATA_INIT) - break; - case C_IO_DATA_INIT: - data_len = hdr->data_length; - - req = alloc_request(ci, data_len); - if (!req) { - conn->c_rx_state = C_IO_CLOSED; - break; - } - ci->rx_req = req; - - /* use le_to_cpu */ - memcpy(&req->rq, hdr, sizeof(req->rq)); - - if (data_len && hdr->flags & SD_FLAG_CMD_WRITE) { - conn->c_rx_state = C_IO_DATA; - conn->rx_length = data_len; - conn->rx_buf = req->data; - } else { - conn->c_rx_state = C_IO_END; - break; - } - case C_IO_DATA: - ret = rx(conn, C_IO_END); - break; - default: - eprintf("BUG: unknown state %d\n", conn->c_rx_state); - } - - if (is_conn_dead(conn) || conn->c_rx_state != C_IO_END) - return; - - /* now we have a complete command */ - - req = ci->rx_req; - - init_rx_hdr(ci); - - if (hdr->flags & SD_FLAG_CMD_WRITE) - req->rp.data_length = 0; - else - req->rp.data_length = hdr->data_length; - - req->done = req_done; - - queue_request(req); -} - -static void init_tx_hdr(struct client_info *ci) -{ - struct sd_rsp *rsp = (struct sd_rsp *)&ci->conn.tx_hdr; - struct request *req; - - if (ci->tx_req || list_empty(&ci->done_reqs)) - return; - - memset(rsp, 0, sizeof(*rsp)); - - req = list_first_entry(&ci->done_reqs, struct request, r_wlist); - list_del(&req->r_wlist); - - ci->tx_req = req; - ci->conn.tx_length = sizeof(*rsp); - ci->conn.c_tx_state = C_IO_HEADER; - ci->conn.tx_buf = rsp; - - /* use cpu_to_le */ - memcpy(rsp, &req->rp, sizeof(*rsp)); - - rsp->epoch = node_list_version; - rsp->opcode = req->rq.opcode; - rsp->id = req->rq.id; -} - -static void client_tx_handler(struct client_info *ci) -{ - int ret, opt; - struct sd_rsp *rsp = (struct sd_rsp *)&ci->conn.tx_hdr; - -again: - init_tx_hdr(ci); - if (!ci->tx_req) { - conn_tx_off(&ci->conn); - return; - } - - opt = 1; - setsockopt(ci->conn.fd, SOL_TCP, TCP_CORK, &opt, sizeof(opt)); - - switch (ci->conn.c_tx_state) { - case C_IO_HEADER: - if (rsp->data_length) - ret = tx(&ci->conn, C_IO_DATA_INIT, MSG_MORE); - else - ret = tx(&ci->conn, C_IO_DATA_INIT, 0); - - if (!ret) - break; - - if (rsp->data_length) { - ci->conn.tx_length = rsp->data_length; - ci->conn.tx_buf = ci->tx_req->data; - ci->conn.c_tx_state = C_IO_DATA; - } else { - ci->conn.c_tx_state = C_IO_END; - break; - } - case C_IO_DATA: - ret = tx(&ci->conn, C_IO_END, 0); - if (!ret) - break; - default: - break; - } - - opt = 0; - setsockopt(ci->conn.fd, SOL_TCP, TCP_CORK, &opt, sizeof(opt)); - - if (is_conn_dead(&ci->conn) || ci->conn.c_tx_state != C_IO_END) - return; - - if (ci->conn.c_tx_state == C_IO_END) { - free_request(ci->tx_req); - ci->tx_req = NULL; - goto again; - } -} - -static void destroy_client(struct client_info *ci) -{ - close(ci->conn.fd); - free(ci); -} - -static struct client_info *create_client(int fd) -{ - struct client_info *ci; - - ci = zalloc(sizeof(*ci)); - if (!ci) - return NULL; - - ci->conn.fd = fd; - - INIT_LIST_HEAD(&ci->reqs); - INIT_LIST_HEAD(&ci->done_reqs); - - init_rx_hdr(ci); - - return ci; -} - -static void client_handler(int fd, int events, void *data) -{ - struct client_info *ci = (struct client_info *)data; - - if (events & EPOLLIN) - client_rx_handler(ci); - - if (!is_conn_dead(&ci->conn) && events & EPOLLOUT) - client_tx_handler(ci); - - if (is_conn_dead(&ci->conn)) { - dprintf("closed a connection, %d\n", fd); - unregister_event(fd); - destroy_client(ci); - } -} - -static void listen_handler(int listen_fd, int events, void *data) -{ - struct sockaddr_storage from; - socklen_t namesize; - int fd, ret, opt; - struct client_info *ci; - - namesize = sizeof(from); - fd = accept(listen_fd, (struct sockaddr *)&from, &namesize); - if (fd < 0) { - eprintf("can't accept a new connection, %m\n"); - return; - } - - opt = 1; - ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt)); - if (ret) { - close(fd); - return; - } - - ci = create_client(fd); - if (!ci) { - close(fd); - return; - } - - ret = register_event(fd, client_handler, ci); - if (ret) { - destroy_client(ci); - return; - } - - dprintf("accepted a new connection, %d\n", fd); -} - -static int create_listen_port_fn(int fd, void *data) -{ - return register_event(fd, listen_handler, NULL); -} - -int create_listen_port(int port) -{ - return create_listen_ports(port, create_listen_port_fn, NULL); -} diff --git a/sheep/sheep.c b/sheep/sheep.c deleted file mode 100644 index df8c3e5..0000000 --- a/sheep/sheep.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#include <errno.h> -#include <getopt.h> -#include <inttypes.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/epoll.h> - -#include "sheep.h" -#include "list.h" -#include "util.h" -#include "event.h" - -#define EPOLL_SIZE 4096 -#define DEFAULT_OBJECT_DIR "/tmp" - -static char program_name[] = "sheep"; - -static struct option const long_options[] = -{ - {"dport", required_argument, 0, 'D'}, - {"sport", required_argument, 0, 's'}, - {"foreground", no_argument, 0, 'f'}, - {"debug", no_argument, 0, 'd'}, - {"help", no_argument, 0, 'h'}, - {0, 0, 0, 0}, -}; - -static char *short_options = "D:s:fdh"; - -int nr_nodes; -struct sheepdog_node_list_entry *node_list_entries; - -static void usage(int status) -{ - if (status) - fprintf(stderr, "Try `%s --help' for more information.\n", program_name); - else { - printf("Usage: %s [OPTION] [PATH]\n", program_name); - printf("\ -Virtual Machine Distributed File System Object Store Target\n\ - -D, --dport specify the dog listen port number\n\ - -s, --sport specify the sheep (our) listen port number\n\ - -f, --foreground make the program run in the foreground\n\ - -d, --debug print debug messages\n\ - -h, --help display this help and exit\n\ -"); - } - exit(status); -} - -uint32_t node_list_version; - -#define NODE_LIST_UPDATE_INTERVAL 2 - -static struct timer node_list_timer; - -static int node_idx; -int dogport = DOG_LISTEN_PORT; - -int get_node_list(void *buf, unsigned int size, unsigned int *epoch, int *idx, - int set_timer) -{ - int fd, ret = 1; - unsigned int wlen; - struct sheepdog_node_list_entry *ent; - struct sd_node_req hdr; - struct sd_node_rsp *rsp = (struct sd_node_rsp *)&hdr; - - fd = connect_to("localhost", dogport); - if (fd < 0) { - eprintf("can't connect to dog!\n"); - goto out; - } - - memset(&hdr, 0, sizeof(hdr)); - hdr.opcode = SD_OP_GET_NODE_LIST; - hdr.data_length = size; - hdr.epoch = *epoch; - - wlen = 0; - - ret = exec_req(fd, (struct sd_req *)&hdr, buf, &wlen, &size); - - close(fd); - - if (ret) { - eprintf("can't connect to dog!\n"); - ret = -1; - goto out; - } - - if (size <= 0) - goto out; - - ret = size / sizeof(*ent); - *epoch = rsp->epoch; - *idx = rsp->local_idx; -out: - if (set_timer) - add_timer(&node_list_timer, NODE_LIST_UPDATE_INTERVAL); - - return ret; -} - -static void update_node_list(void *data) -{ - int ret, size, idx = 0; - unsigned epoch = 0; - char *buf; - - size = SD_MAX_NODES * sizeof(struct sheepdog_node_list_entry); - - buf = zalloc(size); - if (!buf) - return; - - ret = get_node_list(buf, size, &epoch, &idx, 1); - - if (ret > 0 && epoch != node_list_version) { - memcpy(node_list_entries, buf, size); - node_list_version = epoch; - nr_nodes = ret; - node_idx = idx; - } - - free(buf); -} - -static int init_node_list(void) -{ - int ret, size, idx = 0; - unsigned epoch = 0; - - size = SD_MAX_NODES * sizeof(struct sheepdog_node_list_entry); - - node_list_entries = zalloc(size); - - ret = get_node_list(node_list_entries, size, &epoch, &idx, 0); - if (ret > 0) { - node_list_version = epoch; - node_idx = idx; - nr_nodes = ret; - } - - node_list_timer.callback = update_node_list; - - add_timer(&node_list_timer, NODE_LIST_UPDATE_INTERVAL); - - return 0; -} - -int main(int argc, char **argv) -{ - int ch, longindex; - int ret, port = SHEEP_LISTEN_PORT; - char *dir = DEFAULT_OBJECT_DIR; - int is_daemon = 1; - int is_debug = 0; - - while ((ch = getopt_long(argc, argv, short_options, long_options, - &longindex)) >= 0) { - switch (ch) { - case 'D': - dogport = atoi(optarg); - break; - case 's': - port = atoi(optarg); - break; - case 'f': - is_daemon = 0; - break; - case 'd': - is_debug = 1; - break; - case 'h': - usage(0); - break; - default: - usage(1); - break; - } - } - - if (optind != argc) - dir = argv[optind]; - - ret = log_init(program_name, LOG_SPACE_SIZE, is_daemon, is_debug); - if (ret) - exit(1); - - if (is_daemon && daemon(0, 0)) - exit(1); - - ret = init_event(EPOLL_SIZE); - if (ret) - exit(1); - - ret = init_node_list(); - - ret = create_listen_port(port); - if (ret) - exit(1); - - ret = init_store(dir); - if (ret) - exit(1); - - init_worker(); - - event_loop(-1); - - return 0; -} diff --git a/sheep/sheep.h b/sheep/sheep.h deleted file mode 100644 index 57c2069..0000000 --- a/sheep/sheep.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#ifndef __VOST_H__ -#define __VOST_H__ - -#include <inttypes.h> - -#include "sheepdog_proto.h" -#include "list.h" -#include "event.h" -#include "logger.h" -#include "work.h" -#include "net.h" - -struct client_info { - struct connection conn; - - struct request *rx_req; - - struct request *tx_req; - - struct list_head reqs; - struct list_head done_reqs; -}; - -struct request; - -typedef void (*req_end_t)(struct request *); - -struct request { - struct sd_req rq; - struct sd_rsp rp; - - void *data; - - struct client_info *ci; - struct list_head r_siblings; - struct list_head r_wlist; - - req_end_t done; - struct work work; -}; - -extern uint32_t node_list_version; - -extern int nr_nodes; -extern int dogport; -extern struct sheepdog_node_list_entry *node_list_entries; - -int create_listen_port(int port); - -int init_store(char *dir); - -void queue_request(struct request *req); - -int get_node_list(void *buf, unsigned int size, unsigned int *epoch, int *idx, - int set_timer); -#endif diff --git a/sheep/store.c b/sheep/store.c deleted file mode 100644 index 9a65d1d..0000000 --- a/sheep/store.c +++ /dev/null @@ -1,460 +0,0 @@ -/* - * Copyright (C) 2009 Nippon Telegraph and Telephone Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#include <dirent.h> -#include <errno.h> -#include <fcntl.h> -#include <mntent.h> -#include <poll.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <openssl/sha.h> -#include <arpa/inet.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <sys/xattr.h> -#include <sys/sendfile.h> -#include <sys/statvfs.h> - -#include "sheep.h" -#include "meta.h" -#include "util.h" - -static char *obj_dir; -static char *mnt_dir; -static char *zero_block; - -static int stat_sheep(uint64_t *store_size, uint64_t *store_free) -{ - struct statvfs vs; - int ret; - DIR *dir; - struct dirent *d; - uint64_t used = 0; - struct stat s; - char path[1024]; - - ret = statvfs(mnt_dir, &vs); - if (ret) - return SD_RES_EIO; - - dir = opendir(obj_dir); - if (!dir) - return SD_RES_EIO; - - while ((d = readdir(dir))) { - if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) - continue; - - snprintf(path, sizeof(path), "%s/%s", obj_dir, d->d_name); - - ret = stat(path, &s); - if (ret) - continue; - - used += s.st_size; - } - - *store_size = vs.f_frsize * vs.f_bfree; - *store_free = vs.f_frsize * vs.f_bfree - used; - - return SD_RES_SUCCESS; -} - -static int get_vdi_epoch(uint64_t oid, unsigned int *epoch) -{ - struct sd_vdi_req hdr; - struct sd_vdi_rsp *rsp = (struct sd_vdi_rsp *)&hdr; - int fd, ret; - unsigned int rlen, wlen; - - memset(&hdr, 0, sizeof(hdr)); - - hdr.opcode = SD_OP_GET_EPOCH; - hdr.base_oid = oid; - hdr.epoch = node_list_version; - - fd = connect_to("localhost", dogport); - if (fd < 0) { - eprintf("can't connect to dog!\n"); - return -1; - } - - wlen = 0; - rlen = 0; - - ret = exec_req(fd, (struct sd_req *)&hdr, NULL, &wlen, &rlen); - if (!ret) - *epoch = rsp->vdi_epoch; - - close(fd); - - if (ret) - return -1; - - return 0; -} - -static int read_from_one(uint64_t oid, unsigned int epoch, - unsigned *rlen, void *buf, uint64_t offset) -{ - int i, n, nr, fd, ret; - unsigned wlen; - char name[128]; - struct sheepdog_node_list_entry *e; - void *p = NULL; - struct sd_obj_req hdr; - struct sd_obj_rsp *rsp = (struct sd_obj_rsp *)&hdr; - - if (epoch == node_list_version) { - nr = nr_nodes; - e = node_list_entries; - } else { - int idx; - unsigned size; - - size = SD_MAX_NODES * sizeof(struct sheepdog_node_list_entry); - - p = zalloc(size); - if (!p) - return -1; - - ret = get_node_list(p, size, &epoch, &idx, 0); - if (ret <= 0) { - free(p); - return -1; - } - - nr = ret; - e = (struct sheepdog_node_list_entry *)p; - } - -again: - for (i = 0; i < nr; i++) { - n = obj_to_sheep(e, nr, oid, i); - - snprintf(name, sizeof(name), "%d.%d.%d.%d", - e[n].addr[12], e[n].addr[13], e[n].addr[14], e[n].addr[15]); - - fd = connect_to(name, e[n].port); - if (fd < 0) - continue; - - memset(&hdr, 0, sizeof(hdr)); - hdr.opcode = SD_OP_READ_OBJ; - hdr.oid = oid; - hdr.epoch = node_list_version; - - hdr.flags = 0; - hdr.data_length = *rlen; - hdr.offset = offset; - - ret = exec_req(fd, (struct sd_req *)&hdr, buf, &wlen, rlen); - - close(fd); - - if (ret) - continue; - - switch (rsp->result) { - case SD_RES_SUCCESS: - return 0; - case SD_RES_OLD_NODE_VER: - case SD_RES_NEW_NODE_VER: - /* waits for the node list timer */ - sleep(2); - goto again; - break; - default: - ; - } - } - - return -1; -} - -static int read_from_other_sheeps(uint64_t oid, char *buf, int copies) -{ - int ret; - unsigned int rlen; - unsigned epoch; - uint64_t offset, eidx; - struct sheepdog_inode *i; - - ret = get_vdi_epoch(oid_to_ino(oid), &epoch); - if (ret) - return -1; - - rlen = sizeof(unsigned); - eidx = (oid & ((1ULL << DATA_SPACE_SHIFT) - 1)) - 1; - offset = (char *)&(i->epoch[eidx]) - (char *)i; - - ret = read_from_one(oid_to_ino(oid), epoch, &rlen, &epoch, offset); - if (ret) - return -1; - - rlen = SD_DATA_OBJ_SIZE; - - ret = read_from_one(oid, epoch, &rlen, buf, 0); - - return ret; -} - -static void __queue_request(struct work *work, int idx) -{ - struct request *req = container_of(work, struct request, work); - char path[1024]; - int fd = -1, ret = SD_RES_SUCCESS; - int flags = O_RDWR; - char *buf = zero_block + idx * SD_DATA_OBJ_SIZE; - char aname[] = "user.sheepdog.copies"; - struct sd_obj_req *hdr = (struct sd_obj_req *)&req->rq; - struct sd_obj_rsp *rsp = (struct sd_obj_rsp *)&req->rp; - uint64_t oid = hdr->oid; - uint32_t opcode = hdr->opcode; - uint32_t req_node_list_version = hdr->epoch; - struct sd_node_rsp *nrsp = (struct sd_node_rsp *)&req->rp; - int copies; - - /* use le_to_cpu */ - - snprintf(path, sizeof(path), "%s/%" PRIx64, obj_dir, oid); - - dprintf("%d, %x, %s, %u, %u\n", idx, opcode, path, - node_list_version, req_node_list_version); - - if (!nr_nodes) { - /* we haven't got SD_OP_GET_NODE_LIST response yet. */ - ret = SD_RES_SYSTEM_ERROR; - goto out; - } - - if (opcode != SD_OP_GET_NODE_LIST) { - if (before(req_node_list_version, node_list_version)) { - ret = SD_RES_OLD_NODE_VER; - eprintf("old node version %u %u, %x %" PRIx64 " %d\n", - node_list_version, req_node_list_version, opcode, - oid, req->ci->conn.fd); - goto out; - } else if (after(req_node_list_version, node_list_version)) { - ret = SD_RES_NEW_NODE_VER; - eprintf("protocol bug, new node version %u %u %x %" PRIx64 "\n", - node_list_version, req_node_list_version, opcode, - oid); - goto out; - } - } - - switch (opcode) { - case SD_OP_CREATE_AND_WRITE_OBJ: - case SD_OP_WRITE_OBJ: - case SD_OP_READ_OBJ: - case SD_OP_SYNC_OBJ: - if (opcode == SD_OP_CREATE_AND_WRITE_OBJ) - flags |= O_CREAT; - - fd = open(path, flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); - if (fd < 0) { - if (errno == ENOENT) - ret = SD_RES_NO_OBJ; - else - ret = SD_RES_UNKNOWN; - - goto out; - } - - if (opcode == SD_OP_CREATE_AND_WRITE_OBJ) { - if (!hdr->copies) { - eprintf("zero copies is invalid\n"); - ret = SD_RES_INVALID_PARMS; - goto out; - } - - ret = ftruncate(fd, 0); - if (ret) { - ret = SD_RES_EIO; - goto out; - } - - ret = fsetxattr(fd, aname, &hdr->copies, - sizeof(hdr->copies), 0); - if (ret) { - eprintf("use 'user_xattr' option?\n"); - ret = SD_RES_SYSTEM_ERROR; - goto out; - } - - if (is_data_obj(oid)) { - if (hdr->flags & SD_FLAG_CMD_COW) { - dprintf("%" PRIu64 "\n", hdr->cow_oid); - - ret = read_from_other_sheeps(hdr->cow_oid, buf, - hdr->copies); - if (ret) { - ret = 1; - goto out; - } - } else { - dprintf("%" PRIu64 "\n", oid); - memset(buf, 0, SD_DATA_OBJ_SIZE); - } - - dprintf("%" PRIu64 "\n", oid); - - ret = pwrite64(fd, buf, SD_DATA_OBJ_SIZE, 0); - if (ret != SD_DATA_OBJ_SIZE) { - ret = SD_RES_EIO; - goto out; - } - } - } - default: - break; - } - - switch (opcode) { - case SD_OP_REMOVE_OBJ: - ret = unlink(path); - if (ret) - ret = 1; - break; - case SD_OP_READ_OBJ: - /* - * TODO: should be optional (we can use the flags) for - * performance; qemu doesn't always need the copies. - */ - copies = 0; - ret = fgetxattr(fd, aname, &copies, sizeof(copies)); - if (ret != sizeof(copies)) { - ret = SD_RES_SYSTEM_ERROR; - goto out; - } - - ret = pread64(fd, req->data, hdr->data_length, hdr->offset); - if (ret < 0) - ret = SD_RES_EIO; - else { - rsp->data_length = ret; - rsp->copies = copies; - ret = SD_RES_SUCCESS; - } - break; - case SD_OP_CREATE_AND_WRITE_OBJ: - case SD_OP_WRITE_OBJ: - ret = pwrite64(fd, req->data, hdr->data_length, hdr->offset); - if (ret != hdr->data_length) { - ret = SD_RES_EIO; - goto out; - } else - ret = SD_RES_SUCCESS; - break; - case SD_OP_SYNC_OBJ: - ret = fsync(fd); - if (ret) { - if (errno == EIO) - ret = SD_RES_EIO; - else - ret = SD_RES_UNKNOWN; - } - break; - case SD_OP_STAT_SHEEP: - ret = stat_sheep(&nrsp->store_size, &nrsp->store_free); - break; - } -out: - if (ret != SD_RES_SUCCESS) { - dprintf("failed, %d, %x, %s, %u, %u\n", idx, opcode, path, - node_list_version, req_node_list_version); - - rsp->result = ret; - } - - if (fd != -1) - close(fd); -} - -static void __done(struct work *work, int idx) -{ - struct request *req = container_of(work, struct request, work); - - req->done(req); -} - -void queue_request(struct request *req) -{ - req->work.fn = __queue_request; - req->work.done = __done; - - list_del(&req->r_wlist); - - queue_work(&req->work); -} - -int init_store(char *dir) -{ - int ret; - struct mntent *mnt; - struct stat s, ms; - FILE *fp; - - ret = stat(dir, &s); - if (ret) { - if (errno == ENOENT) { - ret = mkdir(dir, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP); - if (ret) { - eprintf("can't create the object dir %s, %m\n", - dir); - return 1; - } else { - ret = stat(dir, &s); - if (ret) - return 1; - - eprintf("created the object dir %s\n", dir); - } - } else { - eprintf("can't handle the object dir %s, %m\n", dir); - return 1; - } - } else if (!S_ISDIR(s.st_mode)) { - eprintf("%s is not a directory\n", dir); - return 1; - } - - obj_dir = dir; - - fp = setmntent(MOUNTED, "r"); - if (!fp) - return 1; - - while ((mnt = getmntent(fp))) { - ret = stat(mnt->mnt_dir, &ms); - if (ret) - continue; - - if (ms.st_dev == s.st_dev) { - mnt_dir = strdup(mnt->mnt_dir); - break; - } - } - - endmntent(fp); - - zero_block = zalloc(SD_DATA_OBJ_SIZE * NR_WORKER_THREAD); - if (!zero_block) - return 1; - - return ret; -} diff --git a/sheep/work.c b/sheep/work.c deleted file mode 100644 index 4df8dc0..0000000 --- a/sheep/work.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (C) 2007 FUJITA Tomonori <tomof at acm.org> - * Copyright (C) 2007 Mike Christie <michaelc at cs.wisc.edu> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, version 2 of the - * License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#include <errno.h> -#include <string.h> -#include <inttypes.h> -#include <pthread.h> -#include <stdio.h> -#include <unistd.h> -#include <fcntl.h> -#include <signal.h> -#include <syscall.h> -#include <sys/types.h> -#include <linux/types.h> -#include <linux/signalfd.h> - -#include "list.h" -#include "util.h" -#include "work.h" -#include "logger.h" -#include "event.h" - -extern int signalfd(int fd, const sigset_t *mask, int flags); - -struct worker_info { - pthread_t worker_thread[NR_WORKER_THREAD]; - - pthread_mutex_t finished_lock; - struct list_head finished_list; - - /* wokers sleep on this and signaled by tgtd */ - pthread_cond_t pending_cond; - /* locked by tgtd and workers */ - pthread_mutex_t pending_lock; - /* protected by pending_lock */ - struct list_head pending_list; - - pthread_mutex_t startup_lock; - - int sig_fd; - - int stop; -}; - -static struct worker_info __wi; - -static void bs_thread_request_done(int fd, int events, void *data) -{ - int ret; - struct worker_info *wi = data; - struct work *work; - struct signalfd_siginfo siginfo[16]; - LIST_HEAD(list); - - ret = read(fd, (char *)siginfo, sizeof(siginfo)); - if (ret <= 0) { - return; - } - - pthread_mutex_lock(&wi->finished_lock); - list_splice_init(&wi->finished_list, &list); - pthread_mutex_unlock(&wi->finished_lock); - - while (!list_empty(&list)) { - work = list_first_entry(&list, struct work, w_list); - list_del(&work->w_list); - - work->done(work, 0); - } -} - -static void *worker_routine(void *arg) -{ - struct worker_info *wi = &__wi; - struct work *work; - pthread_t *p = arg; - int idx = p - wi->worker_thread; - sigset_t set; - - sigfillset(&set); - sigprocmask(SIG_BLOCK, &set, NULL); - - pthread_mutex_lock(&wi->startup_lock); - dprintf("started this thread %d\n", idx); - pthread_mutex_unlock(&wi->startup_lock); - - while (!wi->stop) { - pthread_mutex_lock(&wi->pending_lock); - retest: - if (list_empty(&wi->pending_list)) { - pthread_cond_wait(&wi->pending_cond, &wi->pending_lock); - if (wi->stop) { - pthread_mutex_unlock(&wi->pending_lock); - pthread_exit(NULL); - } - goto retest; - } - - work = list_first_entry(&wi->pending_list, - struct work, w_list); - - list_del(&work->w_list); - pthread_mutex_unlock(&wi->pending_lock); - - work->fn(work, idx); - - pthread_mutex_lock(&wi->finished_lock); - list_add_tail(&work->w_list, &wi->finished_list); - pthread_mutex_unlock(&wi->finished_lock); - - kill(getpid(), SIGUSR2); - } - - pthread_exit(NULL); -} - -int init_worker(void) -{ - int i, ret; - sigset_t mask; - struct worker_info *wi = &__wi; - - INIT_LIST_HEAD(&wi->pending_list); - INIT_LIST_HEAD(&wi->finished_list); - - pthread_cond_init(&wi->pending_cond, NULL); - - pthread_mutex_init(&wi->finished_lock, NULL); - pthread_mutex_init(&wi->pending_lock, NULL); - pthread_mutex_init(&wi->startup_lock, NULL); - - sigemptyset(&mask); - sigaddset(&mask, SIGUSR2); - sigprocmask(SIG_BLOCK, &mask, NULL); - - wi->sig_fd = signalfd(-1, &mask, 0); - if (wi->sig_fd < 0) { - eprintf("failed to create a signal fd, %m\n"); - return 1; - } - - ret = fcntl(wi->sig_fd, F_GETFL); - ret = fcntl(wi->sig_fd, F_SETFL, ret | O_NONBLOCK); - - ret = register_event(wi->sig_fd, bs_thread_request_done, wi); - if (ret) { - eprintf("failed to add epoll event\n"); - goto destroy_cond_mutex; - } - - pthread_mutex_lock(&wi->startup_lock); - for (i = 0; i < NR_WORKER_THREAD; i++) { - ret = pthread_create(&wi->worker_thread[i], NULL, - worker_routine, &wi->worker_thread[i]); - - if (ret) { - eprintf("failed to create a worker thread, %d %s\n", - i, strerror(ret)); - if (ret) - goto destroy_threads; - } - } - pthread_mutex_unlock(&wi->startup_lock); - - return 0; -destroy_threads: - - wi->stop = 1; - pthread_mutex_unlock(&wi->startup_lock); - for (; i > 0; i--) { - pthread_join(wi->worker_thread[i - 1], NULL); - eprintf("stopped the worker thread %d\n", i - 1); - } - - unregister_event(wi->sig_fd); -destroy_cond_mutex: - pthread_cond_destroy(&wi->pending_cond); - pthread_mutex_destroy(&wi->pending_lock); - pthread_mutex_destroy(&wi->startup_lock); - pthread_mutex_destroy(&wi->finished_lock); - - return 1; -} - -void exit_worker(void) -{ - int i; - struct worker_info *wi = &__wi; - - wi->stop = 1; - pthread_cond_broadcast(&wi->pending_cond); - - for (i = 0; wi->worker_thread[i] && - i < ARRAY_SIZE(wi->worker_thread); i++) - pthread_join(wi->worker_thread[i], NULL); - - pthread_cond_destroy(&wi->pending_cond); - pthread_mutex_destroy(&wi->pending_lock); - pthread_mutex_destroy(&wi->startup_lock); - pthread_mutex_destroy(&wi->finished_lock); - - unregister_event(wi->sig_fd); - - wi->stop = 0; -} - -void queue_work(struct work *work) -{ - struct worker_info *wi = &__wi; - - pthread_mutex_lock(&wi->pending_lock); - - list_add_tail(&work->w_list, &wi->pending_list); - - pthread_mutex_unlock(&wi->pending_lock); - - pthread_cond_signal(&wi->pending_cond); -} diff --git a/sheep/work.h b/sheep/work.h deleted file mode 100644 index 81d8c56..0000000 --- a/sheep/work.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __WORK_H__ -#define __WORK_H__ - -#define NR_WORKER_THREAD 4 - -struct work; - -typedef void (*work_func_t)(struct work *, int idx); - -struct work { - struct list_head w_list; - work_func_t fn; - work_func_t done; -}; - -int init_worker(void); -void exit_worker(void); -void queue_work(struct work *work); - -#endif -- 1.6.3.3 |